I did not get the float | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I did not get the float

8th Sep 2021, 9:48 AM
Lucky Saini
Lucky Saini - avatar
3 Answers
+ 4
Float is similar to a decimal number. For example: 7.2 is a decimal number 5.0 is also a float because it has the potential to have decimals. Whole numbers are considered to be integers -> int. So an example of int function is 10 / 4 = 2 2, the result is an integer An example of float: 10//4 = 2.5 2.5 is a float I understand your confusion as I also struggled with these concepts when I started.
8th Sep 2021, 10:00 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
➵Chloe[she/her] [DMs Open] [K-POP stan] You are exactly correct! Thanks for pointing that out 😁👍
8th Sep 2021, 6:24 PM
Rik Wittkopp
Rik Wittkopp - avatar
0
Rik Wittkopp I'm not entirely sure, but I think you mixed up integer divide and regular divide, the first one returns a float whereas the second one returns an integer. https://code.sololearn.com/caRN5rgtq4c5/?ref=app
8th Sep 2021, 12:57 PM
Chloe
Chloe - avatar