In 2025.. python 3.12 version, It works effectively.
But your code have problems..
the function should be in lowercase provide_access, run_match
should be like
class Access:
def __init__(self, user, password):
self.user = user
self.password = password
class Run:
def __init__(self):
self.passwords = {}
def add_user(self, user):
if user.user in self.passwords:
print("❌ User already exists.")
else:
self.passwords[user.user] = user.password
print(f"✔ User: {user.user}, Password: {user.password} added successfully!")
def show_pass(self, user):
if user in self.passwords:
print(f"✔ User: {user}, Password: {self.passwords[user]}")
else:
print("❌ User not found.")
run = Run()
while True:
print("""
Hi there, You have three options:
1️⃣ Add user
2️⃣ Show password
3️⃣ Exit
""")
choice = input("Enter your choice: ").strip().title()
if choice == "1":
username = input("Enter your username: ").strip().title()
if username in ["Om", "Vishal"]:
print(f"{username} is not allowed.")
else:
password = input("Enter your password: ").strip()
access = Access(username, password)
run.add_user(access)
elif choice == "2":
username = input("Enter your username: ").strip().title()
run.show_pass(username)
elif choice == "3":
print("Exiting... Have a good day!")
break
else:
print("❌ Invalid choice.")
I wrote it for you.. more advanced & clean..