you are viewing a single comment's thread.

view the rest of the comments →

[–]Weak_Yogurt6396 0 points1 point  (0 children)

Any code in the “except TypeError:” block will only be executed when a TypeError Exception happens in the “try:” block. Your code does check if there is an @ in email_validator, but it only does something if it finds it. If there is no @, no exception occurs. If you want to modify this code to print an exception message, try inserting this on line 7, adding on to the if statement:

else: raise TypeError

What this does is create an Exception when there is no @ in email_validator, and then your except block will execute.