Sometimes, while working with tuple, we can have a problem in which, we need to convert a tuple to floating-point number in which first element represents integer part and next element represents a decimal part. Let’s discuss certain way in which this can be achieved.
Method : Using
join() + float() + str() + generator expression
The combination of above functionalities can solve this problem. In this, we 1st convert the tuple elements into a string, then join them and convert them to desired integer.
The original tuple : (4, 56) The float after conversion from tuple is : 4.56
- Convert String float to float list in Python
- Python | Sort a tuple by its float element
- Python | Convert String to Tuple
- Python | Convert Tuple to integer
- Python | Convert a list into a tuple
- Python | Convert String to tuple list
- Python | Program to convert a tuple to a string
- Python | Convert location coordinates to tuple
- Python | Convert a list into tuple of lists
- Python | Convert String to N chunks tuple
- Python | Convert list of tuple into dictionary
- Python | Convert tuple to adjacent pair dictionary
- Python | Convert tuple records to single string
- Python - Convert Float to digit list
- Python program to convert float decimal to Octal number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.