Question: class EmailNotValidError ( ) : Raised when the target email is not valid def is _ email _ valid

class EmailNotValidError():
""" Raised when the target email is not valid """
def is_email_valid(mailing_list):
for key, email in mailing_list.items(): # Loop through the mailing list:
if '@' not in email: # Check if the email contains an @:
raise # Raise an EmailNotValidError exception if the @ is not present
def is_email_valid_extended(mailing_list):
final_users_list =[] # Array to hold user ids
# Inserted a try.., except.. block to cast the exception
try:
# Loop through the mailing list
for key, email in mailing_list.items(): # Your mailing list:
if '@' in email: # Check if the @ is present in the email:
# Append the id of users with valid emails
else:
raise # Raises an EmailNotValidError otherwise
except # Your user-defined exception:
return # Return a user-friendly message to cast the exception
def is_email_valid_extended_finally(mailing_list):
final_users_list.append(key)= # Array to hold user ids
# Inserted a try.., except.. block to cast the exception
try:
# Loop through the mailing list
for key, email in # Your mailing list:
if '@' in # Check if the @ is present in the email:
# Append the id of users with valid emails
else:
raise # Raises an EmailNotValidError otherwise
except # Your user-defined exception:
# Print a user-friendly message to cast the exception
finally:
return # Return the id of the users with valid email
How do you fix this code?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!