0

If I type int(6.5) on the interpreter prompt, the output is 6.

If I type int(input()), and give 6.5 as an input, then it gives an error:

ValueError: invalid literal for int() with base 10: '6.5'

What is happening here?

Ch3steR
  • 20,090
  • 4
  • 28
  • 58
Subir Nag
  • 103
  • 3

1 Answers1

2

Input() function takes string as input. It is equivalent to doing int('6.5') which is different from int(6.5) -> Casting double/float to int.