Python Forum
Type Error or Value Error? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Type Error or Value Error? (/thread-28486.html)



Type Error or Value Error? - spalisetty06 - Jul-21-2020

print(int("100.0"))
it is type error, how is it value error?


RE: Type Error or Value Error? - deanhystad - Jul-21-2020

Execute the statement and see what exception pops up.


RE: Type Error or Value Error? - spalisetty06 - Jul-21-2020

@deanhystad I saw that it says value error but I feel that for whatever value of the float, it will give the error and not just some of the values, so it should be type error?


RE: Type Error or Value Error? - deanhystad - Jul-21-2020

int(arg) accepts strings as an argument, so it is not going to be a type error, no matter what is contained in the string. int(list) is a type error because list is not a valid argument type.