Skip to content

17.Write a menu-driven Python program to check whether the email entered by the user is valid. Conditions: Contains “@” Contains “.” No spaces

ASSIGNMENT

Q.17

17.Write a menu-driven Python program to check whether the email entered by the user is valid. Conditions: Contains “@” Contains “.” No spaces

# Menu-driven program to validate an email address while True: print("\n========== EMAIL VALIDATION MENU ==========") print("1. Enter Email and Check Validity") print("2. Exit") print("===========================================") choice = int(input("Enter your choice: ")) if choice == 1: email = input("Enter email address: ") if "@" in email and "." in email and " " not in email: print("Valid Email Address") else: print("Invalid Email Address") elif choice == 2: print("Program terminated.") break else: print("Invalid choice. Please try again.")