123
123
")
while True: print()
print("1. Sign up") elif choice == 3:
print("2. Login") break
print("3. Quit") else:
choice = int(input("Enter Your Choice: ")) print("Invalid choice. Please try again.")
if choice == 1:
key = str(input("Enter the User Name: ")) 5… import random
if key in cred: class MathQuizGenerator:
print() def __init__(self):
print("Username already exists.") self.difficulty_ranges = {
print() 'easy': (1, 10),
else: 'medium': (10, 50),
cred[key] = str(input("Enter the password: ")) 'hard': (50, 100)
print() }
print("Sign up successful!") self.opera ons = {
print() '+': self.add,
elif choice == 2: '-': self.subtract,
key = str(input("Enter the User Name: ")) '*': self.mul ply,
if key not in cred: '/': self.divide
print() }
print("User not found.") def add(self, num1, num2):
print() return num1 + num2
else: def subtract(self, num1, num2):
password = str(input("Enter password: ")) return num1 - num2
if cred[key] == password: def mul ply(self, num1, num2):
print() return num1 * num2
print("Welcome!") def divide(self, num1, num2):
print() return num1 / num2 if num2 != 0 else None
else: def generate_ques on(self, difficulty):
print() num1 = random.randint(*self.difficulty_ranges[difficulty])