0
What is the difference between int(input("Enter you number here: ")) and float(input("Enter your Number here: ")).
How and when to use them? Thanks.
4 Answers
+ 4
Adesiyan Joseph the difference is in the data-type when you use the first one the program expects an integer value as input but in the latter it expects a float value i.e number containing a decimal.
External link đ to understand data-type:
https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/variables-datatypes
+ 2
Thanks @iyke4life
+ 1
The input() method will result in a string type entered by the user.
If you expect a number because you want to use it in your program for calculations, you convert it to integer or float type. Which one you need, will depend on the situation (the rest of the code)
0
Thanks @Tibor