Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- def csv_read():
- db = []
- file = "FakeNames3.csv"
- with open(file, "r") as a:
- reader = csv.reader(a)
- for row in reader:
- db.append(row)
- return db
- def findStudent():
- while True:
- try:
- IDChoice = str(input("Enter Pupil ID: "))
- break
- except ValueError:
- print("Invalid Input, ID must be an integer")
- found = False
- for row in pupils:
- print(row[0], "and", IDChoice)
- if row[0] == IDChoice:
- print("Pupil Found:")
- found = True
- for a in range(0,13):
- print(row)
- if found == False:
- print("Invalid pupil ID, pupil not found")
- print("Returning to main menu...")
- menu()
- def reports():
- print("Filler")
- def LogOut():
- print("Sucessfully logged out, please log in again")
- LogOn()
- def menu():
- print("~~~~~~~~~~Menu~~~~~~~~~~ \n 1) Find Student \n 2) Produce Reports \n 3) Log Out")
- while True:
- try:
- choice = int(input("Enter the corresponding number for your choice: "))
- if choice > 0 and choice < 4:
- break
- else:
- print("Please enter a number between 1 and 3")
- except ValueError:
- print("Invalid Input")
- if choice == 1:
- findStudent()
- if choice == 2:
- reports()
- if choice == 3:
- LogOut()
- def LogOn():
- print("~~~~~~~~~~WElCOME~~~~~~~~~~")
- logged = False
- while logged == False:
- while True:
- try:
- user = input("Enter username: ")
- passw = input("Enter password: ")
- break
- except ValueError:
- print("Invalid entries, please try again")
- if user == realUser and passw == realPass:
- print("Welcome, Mr Leeman!")
- logged = True
- else:
- print("Incorrect username and/or password")
- menu()
- def LogOn():
- print("~~~~~~~~~~WElCOME~~~~~~~~~~")
- logged = False
- while logged == False:
- while True:
- try:
- user = input("Enter username: ")
- passw = input("Enter password: ")
- break
- except ValueError:
- print("Invalid entries, please try again")
- if user == realUser and passw == realPass:
- print("Welcome, Mr Leeman!")
- logged = True
- else:
- print("Incorrect username and/or password")
- menu()
- def LogOn(db):
- found = False
- username = input("entre,username")
- password = input("entre, password")
- strAT = "@"
- if len(username)> 0 and len(password)> 0:
- print("your password and username is above 0")
- if username.find(strAT) != -1:
- print("@ found")
- for each_record in db:
- if each_record[11] == username and each_record[12]==password:
- found = True
- print("username and pass found")
- else:
- print("username and pass not found")
- else:
- print("no @")
- else:
- print("username or pass length below 0")
- return found
- menu()
- pupils = []
- pupils = csv_read()
- realUser = "LeeMr"
- realPass = "Pass421"
- LogOn()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement