Example:
tuple = ("python", "includehelp", 43, 54.23)
Converting Tuple elements to Float Value
In this article, we are given a tuple consisting of two elements. Our task is to create a Python program to convert the elements of the tuple to a float value.
Input:
(5, 1)
Output:
5.1
We will loop over the tuple and use the str() method to convert the elements to string with are joined using the join() method and finally the float() method performs the final conversion.
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer