Preview:
import re

# read phone number from user
phone_number = input("Enter your phone number: ")

# validate phone number using regex
if re.match(r'^\d{10}$', phone_number):
    print("Phone number is valid.")
else:
    print("Phone number is invalid.")

# read email ID from user
email_id = input("Enter your email ID: ")

# validate email ID using regex
if re.match(r'^[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z]{2,}$', email_id):
    print("Email ID is valid.")
else:
    print("Email ID is invalid.")

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter