You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
temperature=float(input("Please type in a temperature: "))
print("The temperature is", temperature)
print("...and rounded down it is", int(temperature))
with the output block
Please type in a temperature: 5.15
The temperature is 5.15
...and rounded down it is 5
the text incorrectly says:
Notice the function always rounds down, and not according to the rounding rules in mathematics. This is an example of a floor function.
However, this is not the mathematical floor function. For a negative number such as -4.1, it produces -4, instead of -5, which is the true output from the mathematical floor function.
The python int() function merely does truncation, and not flooring. See this stackoverflow page for reference and an example.
The text was updated successfully, but these errors were encountered:
In the lesson in part 2, https://programming-24.mooc.fi/part-2/1-programming-terminology, it says:
with the output block
the text incorrectly says:
However, this is not the mathematical floor function. For a negative number such as -4.1, it produces -4, instead of -5, which is the true output from the mathematical floor function.
The python
int()
function merely does truncation, and not flooring. See this stackoverflow page for reference and an example.The text was updated successfully, but these errors were encountered: