if you look at the previous post:
How do I catch the error message if the user gives wrong input (without using isinstance)?[
^], it explain how to display the detail error message with a demo.
the below line will give the error "NameError: name 'a' is not defined on line xx"
room1 = Hotel(a,"A")
the below line will give the error "TypeError: on line xx"
room1 = Hotel('a',"A")
As you can see, the first line is complaining about
a
is not a valid variable and it doesn't call the
Hotel
class
The second line, call the
Hotel
class and throw type error.
8. Errors and Exceptions — Python 3.7.2 documentation[
^]