+ 2
Exception
try: num=5/int(input()) print(num) except: print("an error occur") raise I put a as input ....and it raise ValueError.....pls why did it raise ValueError and not TypeError
3 Antworten
+ 1
an error occur
Traceback (most recent call last):
File "file0.py", line 2, in <module>
num=5/(input())
TypeError: unsupported operand type(s) for /: 'int' and 'str'
if you want a TypeError delete int so divide int / str
+ 1
Prince Kumar in wht kind of example would that second example be type error