Advertisement
Guest User

Untitled

a guest
Mar 14th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.48 KB | None | 0 0
  1. def pick1():
  2.     print('Login option/play game option chosen')
  3.     welcome=input("Do you have an acount? y/n: ")
  4.     if welcome == "n":
  5.         while True:
  6.             username  = input("Enter a username:")
  7.             password  = input("Enter a password:")
  8.             password1 = input("Confirm password:")
  9.             print("You have now logged in")
  10.             if password == password1:
  11.                 file = open("Names.txt", "w")
  12.                 file.write(username+":"+password)
  13.                 file.close()
  14.                 welcome = "y"
  15.                 break
  16.                 print("Passwords do NOT match!")
  17.                
  18.              
  19.     if welcome == "y":
  20.         while True:
  21.             login1 = input("Login:")
  22.             login2 = input("Password:")
  23.             file = open("Names.txt", "r")
  24.             data = file.readline()
  25.             file.close()
  26.             if data == login1+":"+login2:
  27.                 print("Welcome")
  28.             else:  
  29.                  print("Incorrect username or password.")
  30.                  return
  31.                  
  32.  
  33.             game=input("Would you like to play the game? y/n(n=exit game): ")
  34.             if game =="n":
  35.                 print(quit)
  36.                
  37.             if game =="y":
  38.                 print("Welcome to the game")
  39.                 import string
  40.                 artistlist=['UnlikePluto','BTS','WittLowry','XXXTentaction']
  41.                 songlist=['-Riptide\n','-Save me\n','-Ghost\n','-Sad\n']
  42.                 outF = open("NewSongl.txt","w")
  43.                 outF.write("\n".join(map(lambda x: str(x), artistlist)))
  44.                 outF.close()
  45.                
  46.                
  47.  
  48.  
  49.                
  50.                                
  51. def pick2():
  52.     print('View Scoreboard')
  53.     return menu
  54.  
  55. def pick3():
  56.     print('Exit game')
  57.     print(quit)
  58.     return menu
  59.  
  60.  
  61. def menu():
  62.     while True:
  63.         result=input("""
  64.        Select an option please (1-3)
  65.        1 - Login option/play game option chosen (includes sign in)
  66.        2 - View Scoreboard
  67.        3 - Exit game
  68.  
  69.        Please enter your choice: """)
  70.         if result=='1':
  71.             return pick1
  72.         if result=='2':
  73.             return pick2
  74.         if result=='3':
  75.             return pick3
  76.         if result.lower()=='exit':
  77.             return
  78.         print('Bad input')
  79.  
  80. def main():
  81.     func=menu
  82.     while True:
  83.         func=func()
  84.         if func is None:
  85.             break
  86.  
  87. if __name__=='__main__':
  88.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement