Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- email = input()
- while True:
- command = input()
- if command == "Valid":
- break
- data = command.split()
- action = data[0]
- if action == "Upper":
- index = int(data[1])
- email = email[:index] + email[index].upper() + email[index + 1:]
- print(email)
- elif action == "Lower":
- index = int(data[1])
- email = email[:index] + email[index].lower() + email[index + 1:]
- print(email)
- elif action == "Insert":
- index = int(data[1])
- char = data[2]
- email = email[:index] + char + email[index:]
- print(email)
- elif action == "Change":
- char = data[1]
- value = int(data[2])
- if char in email:
- new = ord(char) + value
- email = email.replace(char, chr(new))
- print(email)
- elif action == "Validation":
- upper_count = 0
- lower_count = 0
- digit_count = 0
- others = 0
- for a in email:
- if not a.isdigit() and not a.isalpha() and not a == "@":
- others += 1
- elif a.isupper():
- upper_count += 1
- elif a.islower():
- lower_count += 1
- elif a.isdigit():
- digit_count += 1
- if len(email) < 6:
- print(f"Email must be at least 6 characters long!")
- if others > 0:
- print("Email must consist only of letters, digits and @!")
- if upper_count == 0:
- print("Email must consist at least one uppercase letter!")
- if lower_count == 0:
- print("Email must consist at least one lowercase letter!")
- if digit_count == 0:
- print("Email must consist at least one digit!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement