Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.96 KB | None | 0 0
  1. import time
  2. import sys
  3. import getpass
  4.  
  5. def login():    
  6.     user = input("Username: ")
  7.     passw = getpass._raw_input("Password: ")
  8.     f = open("users.txt", "r")
  9.     for line in f.readlines():
  10.         us, pw = line.strip().split("|", 1)
  11.         if user == us and passw == pw:
  12.             print("Login successful!")
  13.             f.close()
  14.             return True
  15.     print("Wrong username/password")
  16.     return False
  17.  
  18. def menu():
  19.     print("Hello there! Before we can start, I need your information!")
  20.     time.sleep(2)
  21.     print("What is your age?")
  22.     age = str(input("Age: "))
  23.    
  24.     if str.isdigit(age) == True:
  25.         print("Age can not be a string!")
  26.         print("This form will be restarted in 5 seconds!")
  27.         time.sleep(5)
  28.         menu()
  29.     else:
  30.         if age >= 18:
  31.             print("Alright, looks like you are " + age + " years old!")
  32.             time.sleep(2)
  33.         else:
  34.             print("Uh oh! Looks like you are underage!")
  35.             time.sleep(1)
  36.             print("Ask for your parents' consent to continue!")
  37.             time.sleep(1)
  38.             parentConsent = str(input("I have consent from my parents(True or False): "))
  39.             if parentConsent.casefold() == str.casefold("true"):
  40.                 print("Great! Now we can continue!")
  41.                 time.sleep(2)
  42.             else:
  43.                 print("You cannot continue without parents' consent. Program will exit in 8 seconds")
  44.                 time.sleep(8)
  45.                 sys.exit(["Underage and no parental consent"])
  46.     time.sleep(1)
  47.     print("What is your first name?")    
  48.     firstName = str(input("First name: "))
  49.     time.sleep(1)
  50.     print("Great!")
  51.     time.sleep(1)
  52.     print("What is your last name?")
  53.     lastName = str(input("Last name: "))
  54.     time.sleep(1)
  55.     print("Awesome! I see your name is " + firstName + " " + lastName + "!" + " Nice to meet you, my name is FILLER")
  56.     time.sleep(2)
  57.     print("What is your email address?")
  58.     time.sleep(1)
  59.     emailAddress = str(input("Email: "))    
  60.     if "@nwytg.net" in emailAddress:
  61.         print("Hey! Not using a real email isn't advised!")
  62.         time.sleep(3)
  63.         print("Looks like your email address is " + str(emailAddress) + "!")
  64.     elif "@" not in emailAddress or "." not in emailAddress:
  65.         print("Enter a valid email next time!")
  66.         time.sleep(1)
  67.         print("Looks like your so called 'email' address is " + emailAddress)
  68.     else:
  69.         print("Great! It seems your email address is " + str(emailAddress))
  70.     time.sleep(1)
  71.     print("What is your phone number?")
  72.     phoneNumber = str(input("Phone number: "))
  73.     print("Alright, I see your phone number is " + str(phoneNumber) + "!")
  74.     time.sleep(1)
  75.     print("Alright, that's it. This program will automatically close in 5 seconds.")
  76.     time.sleep(5)
  77.     sys.exit(["Completed"])
  78.  
  79. def main():
  80.     while True:
  81.         log = login()
  82.         if log == True:
  83.              menu()
  84.  
  85.  
  86. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement