I am trying to learn how to raise custom errors in python and I am trying to write code for a program which raises custom error for all strings other than “quit” and for str=”quit” or any integer it raises no error but this is giving wrong ouput. How to fix it? /u/FewNectarine623 Python Education

a = input("Please enter any integer value or value should be quit:") if type(a) is int and a=="quit" : print(a) else: raise ValueError("Your entered value is invalid") 

submitted by /u/FewNectarine623
[link] [comments]

​r/learnpython a = input(“Please enter any integer value or value should be quit:”) if type(a) is int and a==”quit” : print(a) else: raise ValueError(“Your entered value is invalid”) submitted by /u/FewNectarine623 [link] [comments] 

a = input("Please enter any integer value or value should be quit:") if type(a) is int and a=="quit" : print(a) else: raise ValueError("Your entered value is invalid") 

submitted by /u/FewNectarine623
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *