float function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

float function

Does the float function have the same role as the int function ( by converting key presses into numbers) but with decimal?

13th Feb 2018, 10:25 PM
arbaaz
2 Answers
+ 5
Yes, float("5.4") works like int("5"). However, both can also convert numbers so float(5) or int(5.2) is fine.
14th Feb 2018, 12:20 AM
John Wells
John Wells - avatar
+ 2
Thank you for your answer.
24th Feb 2018, 11:07 PM
arbaaz