Get the answers you need at Westonci.ca, where our expert community is always ready to help with accurate information. Join our platform to connect with experts ready to provide detailed answers to your questions in various areas. Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals.
Sagot :
import random
database = {}
while True:
try:
user_choice = int(input("Enter your student id to bring up your information (Press enter if you don't have one) : "))
user_pass = input("Enter your password: ")
if user_choice in database.keys() and database[user_choice][5] == user_pass:
print("User Authenticated! Welcome, "+database[user_choice][1]+" "+database[user_choice][2])
while True:
choice = int(input("Do you wish to choose your modules, view your selected modules, deposit points, or go back to the main menu? (1,2,3,4): "))
if choice == 1:
modules = input("Choose up to two modules (comma separated): Programming 1, Programming 2, Networking 1, Mathematics ")
modules = modules.split(",")
if len(modules) > 2:
print("You're only allowed to select two modules at one time.")
else:
database[user_choice].append(modules)
elif choice == 2:
if len(database[user_choice]) == 8:
print("Your module(s) are:")
for x in database[user_choice][7]:
print(x.strip())
else:
print("You don't have any modules!")
elif choice == 3:
point_deposit = int(input("How many points would you like to deposit: "))
confirm = input("Do you want to deposit "+str(point_deposit)+" point(s) (y/n): ")
if confirm == "y":
database[user_choice][6] += point_deposit
print("Your point balance is now:",database[user_choice][6])
else:
print("Your deposit could not be confirmed! Deposit denied.")
elif choice == 4:
break
except ValueError:
name = input("Enter your first name: ")
last_name = input("Enter your last name: ")
phone_number = input("Enter your phone number: ")
email = input("Enter your email address: ")
password = input("Enter a password: ")
points = 100
student_id = random.randint(1,1000)
while student_id in database.keys():
student_id = random.randint(1,1000)
print("Hello,",name,"your student ID is:",student_id)
database[student_id] = [student_id,name, last_name, phone_number, email, password, points]
Although I tried to cover all the bases, I might've missed something. I hope this helps.
Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. Thank you for visiting Westonci.ca. Stay informed by coming back for more detailed answers.