Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import string
- def start():
- print("Welcome to a Netflix ripoff\nWould you like to register or login?\nType register or login\n")
- selection = input("Would you like to login, register or exit?: ").title()
- if selection == "Register":
- register()
- elif selection == "Login":
- login()
- elif selection == "Exit":
- exit()
- def register():
- def has_uppercase(pw):
- "Password must contain an uppercase letter"
- return len(set(string.ascii_uppercase).intersection(pw)) > 0
- def has_numeric(pw):
- "Password must contain a digit"
- return len(set(string.digits).intersection(pw)) > 0
- def test_password(pw, tests=[has_uppercase, has_numeric]):
- for test in tests:
- if not test(pw):
- print(test.__doc__)
- return False
- return True
- def interestsel():
- interests = input("What are your interests?(seperate with a space): \nSci-Fi,\nAdventure or\nAction\n").title()
- if interests == "":
- print("\nYour account has been created. Please login\n\n")
- start()
- else:
- file = open("accounts.txt","a")
- file.write(interests)
- file.close()
- print("\nYour account has been created. Please login\n\n")
- start()
- def gendersel():
- gender = input("What is your gender (Male or Female): ").title()
- if gender == "Male":
- file = open("accounts.txt","a")
- file.write(gender)
- file.close()
- interestsel()
- elif gender == "Female":
- file = open("accounts.txt","a")
- file.write(gender)
- file.close()
- interestsel()
- else:
- print("\nInvalid gender. Please re-enter your gender: \n")
- gendersel()
- def pwcheck():
- pw = input("What would you like your password to be?: ")
- if test_password(pw):
- file = open("accounts.txt","a")
- file.write(pw+",")
- file.close()
- gendersel()
- else:
- print("\nYour password needs atleast one capital letter and one number, please try again.\n")
- pwcheck()
- def usernamecheck():
- username = input("What would you like your username to be?: ")
- with open("accounts.txt","r+") as file:
- for line in file:
- line = line.split(",")
- if username == line[3]:
- print("\nThis username is already taken please try again.\n")
- usernamecheck()
- else:
- file = open("accounts.txt","a")
- file.write(username+",")
- file.close()
- pwcheck()
- file.close()
- def firstinfo():
- realname = input("What is your realname?: ")
- dob = input("What is your date of birth?(DD/MM/YYYY): ")
- address = input("What is your address?: ")
- file = open("accounts.txt","a")
- file.write("\n"+realname+","+dob+","+address+",")
- file.close()
- usernamecheck()
- firstinfo()
- def login():
- username = input("\nEnter your username: ")
- password = input("Enter your password: ")
- with open("accounts.txt","r+") as file:
- for line in file:
- line = line.split(",")
- if username == line[3] and password == line[4]:
- homepage()
- else:
- print("\n***********************************")
- print("Error. Your username or password is incorrect. Please try again.")
- print("***********************************\n")
- login()
- file.close()
- def watch():
- print("Watching\n")
- start()
- def history():
- print("History\n")
- start()
- def homepage():
- print("****************************")
- print("---===Welcome to your homepage===---")
- print("What would you like to do?: ")
- print("To watch a program, type watch")
- print("To view your watch history, type history")
- print("To logout and exit, type quit")
- print("****************************\n")
- hpselect = input("\n").title()
- if hpselect == "Watch":
- watch()
- elif hpselect == "History":
- history()
- elif hpselect == "Quit":
- exit()
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement