What does float mean?
A real number with a fractional part, such as 3.5 or -0.25. Python calls the type float; exam papers say real.
In a lesson
20 / 5printed4.0, not4:/always gives a float, even when the answer is whole.//gives an integer.roundtidies a long float: the second argument is how many decimal places to keep.
Learn it
- Taught in F1.9 Arithmetic operators Programming basics, GCSE
Used in
- F1.8 Data types and casting
- F1.10 Project: ask and drive
- F2.4 Nested selection and match
- F3.6 Records
- F3.7 Random numbers
- F7.1 Reading and writing files
- F7.5 Project: the logbook
- F10.6 The internet, DNS and the cloud
- 8.4 A tiny network
- 9.3 Protocols
and 28 more lessons.
Do the lesson in the simulator