+ 2
How do I Create a function that converts a float to a string and double it.
def double_float(this_float): # TO DO BELOW: Let the variable doubled = this_float multiplied by 2 # Prints out what this_float doubled is. print(str(doubled) + ' is ' + str(this_float) + ' doubled.') # insert the float you want doubled double_float(319.16)
4 Answers
+ 3
Thank you this is a big help George Ryan
+ 1
def double_float(float):
doubledFloat=float*2
floatString=str(doubledFloat)
print(floatString)
double_float(2.5)
+ 1
prints 5.0
+ 1
Also in order to print the float you do not need to convert it to a string