Ask your own question, for FREE!
Computer Science 17 Online
kekeman:

Which of the following will produce an output of 120.0? float(120) float(120.4) int(120) int(120.4)

kekeman:

I was thinking B.)

Vocaloid:

Hmm close but not quite The float function won’t change the numeric value of a number (120.4 is already a float and is not the same value as 120.0) Any other guesses? What’s the integer that has the same value as 120.0?

kekeman:

int(120)?

Vocaloid:

Remember that int always returns integers (no decimals) Notice float(120). Since 120 is an integer, float(120) will add a decimal component to return 120.0.

kekeman:

Damn i am being slow rn integers are no decimals and float is decimals

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!