+ 1
Why Avg output is float?
2 ответов
+ 2
It is by default, python gives an output in terms of double precision float number.
You can do this if you don't want float number
avg = int((a + b)/2)
+ 1
Prakash Dhar
Lesson 3.1, second section of "Python fir Beginners" has this written in a yellow box.
Using a single slash to divide numbers produces a decimal (or float, as it’s known in programming). We'll dive into floats in the next lesson.
You may wish to review that lesson and play with the code example