+ 1

What is the importance of float statement in python?

29th Mar 2018, 9:44 AM
Cisco
Cisco - avatar
7 Respostas
+ 1
Are you talking about the float() function? The float() function tries to convert its input to float. For example: # finding acceleration a = f / m f = float(input('What is the force: ')) # input returns a string, float() converts it to a floating point number m = float(input('What is the mass: ')) # the same happens here. I need float numbers because 'f' and 'm' can have decimal places. a = f / m # the result will also be a float number.
29th Mar 2018, 10:28 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
thank now in your answer, I guess I want to run the program that you wrote to answer me,when i run it, will the question "what is the force" be ask to me?
29th Mar 2018, 10:43 AM
Cisco
Cisco - avatar
+ 1
If you run the code in the Sololearn playground it will not be asked to you. But if you run it in the interpreter of your computer it will. here is a code that explains how input is handled in sololearn playground: https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
29th Mar 2018, 10:46 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
thank
29th Mar 2018, 11:31 AM
Cisco
Cisco - avatar
+ 1
are you on a social networking site
29th Mar 2018, 11:56 AM
Cisco
Cisco - avatar
0
I'm in sololearn ; )
29th Mar 2018, 12:24 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
another
29th Mar 2018, 12:35 PM
Cisco
Cisco - avatar