Home > OS >  can I know how to identify the error type of the following code
can I know how to identify the error type of the following code

Time:10-17

when the output needs to be an integer, but we input a float, so the output becomes a float too. what is this error called?

#input
o = 0.0

#output
o = 6

but with 0.0, the output is 6.0. it has to be 6. what is this error called?

CodePudding user response:

Probably you mean Type error

Ref : Type Error

CodePudding user response:

Your ide will show the type of the error if you use int() or float() to your input variable. For example,

a = int(input())
print(a)

If input is 6.0 it shows something like this,

ValueError: invalid literal for int() with base 10: '6.0'
  • Related