Advertisement
Guest User

login screen

a guest
Apr 16th, 2019
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1.  
  2. userinformation={} # creates an empty dictionary
  3. check= int(input("Do you alrady have an account? 0 if yes and 1 if no: ")) #user chooses if he has an account already
  4. if check== 0: # if user says yes then he can login
  5.  username=input("Type in Your username: ")  # User types in a username
  6.  password= input("Type in Your password: ") # user types in a password
  7.  if username or password in userinformation:  #checks if the username is already in the dictionary
  8.      print("Username or password already taken please choose another one") #if so then:
  9.  else:
  10.      userinformation[username]=password
  11.      print(userinformation) #else the programm will safe the user inputs and print them out
  12. elif check==1:
  13.      print("please  register: ") # if user says  "no" then he must register
  14.      username=input("Type in a username: ")
  15.      password=input("Type in a passwsord: ")
  16.      userinformation[username]=password #username and password will be saved
  17.      print (userinformation) #and printed
  18. elif check==2:
  19.      print(userinformation) # secret input to print all user who have registered
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement