Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import random
- import os
- #Username and Password
- #Setting an error variable
- error = 0
- running = True
- #Reading a username and password file
- username = open("username.txt", "r")
- usr_read = username.read()
- username.close()
- password = open("password.txt", "r")
- psw_read = password.read()
- password.close()
- #Checking in username and password match
- usr_user = input("Username: ")
- if usr_user == usr_read:
- pass
- else:
- error = 1
- usr_pass = input("Password: ")
- if usr_pass == psw_read:
- pass
- else:
- error = 1
- if error == 1:
- print("error", random.randrange(1, 102))
- time.sleep(1)
- quit()
- else:
- pass
- #Once in gives various options to the user in what they want to do
- while running:
- print("What would you like me to check or would you want me to change username and password? Type user to change usr and pass")
- cmd = input("//")
- lines = []
- #username and password credit to WindleSR https://www.youtube.com/watch?v=ozFu-xxl2Bs
- if cmd == "user":
- print("Fill in the following.")
- new_usr = input("New Username: ")
- newusr = open("username.txt", "w")
- newusr.write(new_usr)
- newusr.close()
- new_psw = input("New Password: ")
- newpsw = open("password.txt", "w")
- newpsw.write(new_psw)
- newpsw.close()
- if cmd == "quit":
- time.sleep(1)
- running = False
- #Ask to check
- if cmd == "homework":
- print("What will you want me to change: check dates, change dates, or view assignments?")
- choice = input("/")
- if choice == "check dates":
- with open('homework.txt', 'rt') as homework: #creating an array and inputting lines of the txt file
- for line in homework:
- lines.append(line)
- print(line[0])
- print("There you go")
- else:
- print("Sorry I do not recognize what you are saying")
- time.sleep(1)
- quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement