+ 1

Why would a number inputted as an integer be saved as a float

floats and integers

20th Nov 2017, 6:14 PM
Tolu Badejo
Tolu Badejo - avatar
2 Respostas
+ 7
hmm, normally all inputs are strings except u convert them: an_int_input = int(input ("Enter an integer:")) a_float_input = float(input ("Enter a float:")) OR maybe u used truediv(/) on the integer, that converts it to a float
20th Nov 2017, 8:05 PM
David Akhihiero
David Akhihiero - avatar
+ 3
Sometimes It's needed to "break" the number into decimals,as using to calculate a user gross and net earnings,based on some parameters.
20th Nov 2017, 6:21 PM
Rafael Figueiredo
Rafael Figueiredo - avatar