+ 1
What is the importance of float statement in python?
7 Answers
+ 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.
+ 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?
+ 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
+ 1
thank
+ 1
are you on a social networking site
0
I'm in sololearn ; )
0
another