Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python3
- user = ''
- passW = ''
- def login():
- correctUser = False
- correctPass = False
- loggedIn = False
- attempts = 0
- print('You are now at the login screen. Enter a username or type "exit" to leave.')
- while correctUser == False:
- user = input()
- if user == 'admin':
- print('Access granted.')
- correctUser = True
- print('Enter the password.')
- elif user == '':
- print('Enter a username.')
- elif user == 'exit':
- print('Exiting.')
- exit()
- else:
- print('"' + user + '" is not a valid username. Try again.')
- while correctPass == False:
- passW = input()
- if passW == 'admin':
- print('Access granted.')
- correctPass = True
- loggedIn = True
- console()
- elif passW == '':
- print('Enter a password.')
- else:
- attempts = attempts + 1
- if attempts == 5:
- print('Too many attempts.')
- exit()
- else:
- print('Access denied. Try again.')
- def console():
- loggedIn = True
- msg = 'You have 3 messages. Type "read" to view, or "back" to go back.'
- print('Welcome to the admin console.')
- while loggedIn == True:
- print('What would you like to do?')
- print('You can try "help," "view messages," or "logout."')
- choice = input()
- if choice == 'help':
- continue
- elif choice == 'view messages':
- print(msg)
- choice = input()
- if choice == 'read':
- msg()
- elif choice == 'back':
- continue
- else:
- stupid = True
- while stupid == True:
- print('You need to either choose "read" or "back."')
- choice = input()
- if choice == 'read':
- msg()
- elif choice == 'back':
- stupid = False
- else:
- continue
- elif choice == 'logout':
- loggedIn = False
- login()
- def msg():
- viewingMessage = True
- msg1 = 'Hi, this is Bob. I was wondering if you finished those documents. Thanks.'
- msg2 = 'Hello, this is Rachel. Do we still have our meeting scheduled for Thursday?'
- msg3 = 'Howdy, this is Randy from engineering. We have a couple of things to look at in the server room and we will need your help. What time are you available?'
- print('You have 3 messages.')
- print('view 1')
- print('view 2')
- print('view 3')
- print('')
- print('What would you like to do?')
- while viewingMessage == True:
- choice = input()
- if choice == 'help':
- print('Your options are one of the messages, "view" to see the list again, or "back."')
- elif choice == 'view 1':
- print(msg1)
- print('')
- elif choice == 'view 2':
- print(msg2)
- print('')
- elif choice == 'view 3':
- print(msg2)
- print('')
- elif choice == 'view':
- print('You have 3 messages.')
- print('view 1')
- print('view 2')
- print('view 3')
- elif choice == 'back':
- stupid = True
- while stupid == True:
- print('Go back to the admin console? (yes/no)')
- choice2 = input()
- if choice2 == 'yes':
- stupid = False
- viewingMessage = False
- console()
- elif choice2 == 'no':
- stupid = False
- print('What would you like to do?')
- else:
- print('You must type "yes" or "no."')
- continue
- else:
- print('Are you stuck? Try typing "help."')
- login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement