Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. Hello, your username is: Greg232
  2. Your password is: userword657
  3. Traceback (most recent call last):
  4. File "F:ComputingTerm 3Username and Password.py", line 62, in <module>
  5. intro()
  6. File "F:ComputingTerm 3Username and Password.py", line 8, in intro
  7. Username_verify()
  8. File "F:ComputingTerm 3Username and Password.py", line 12, in Username_verify
  9. proceed = Username_Submit(name)
  10. File "F:ComputingTerm 3Username and Password.py", line 36, in Username_Submit
  11. print(name[0], name[1])
  12. TypeError: 'function' object is not subscriptable
  13. >>>
  14.  
  15.  
  16.  
  17. import time
  18.  
  19.  
  20. def intro(): #Username and Password is displayed
  21. print("Hello, your username is: Greg232 ")
  22. time.sleep(1)
  23. print("Your password is: userword657")
  24. Username_verify()
  25.  
  26. def Username_verify():
  27. name = Username_Name
  28. proceed = Username_Submit(name)
  29. print(proceed)
  30.  
  31.  
  32. def Username_Name(): #User must input the correct username and password given to them
  33. username = input('Username: ')
  34. double_check = input('Are you sure? ')
  35. if double_check == 'no':
  36. username
  37. if double_check == 'yes':
  38. print('Proceed...')
  39.  
  40. password = input("Password: ")
  41. double_check = input('Are you sure? ')
  42. if double_check == 'no':
  43. print("ok")
  44. if double_check == 'yes':
  45. Username_Submit()
  46.  
  47.  
  48.  
  49.  
  50. def Username_Submit(name):
  51. attempt = 0
  52. print(name[0], name[1])
  53. Submit == ''
  54. input("Submit?") #Double checks that the user is ok with what they entered
  55. if Submit == 'yes':
  56. if name[0] == 'Greg232' and name[1] == 'userword657':
  57. Username_Correct()
  58. while password != "userword657" and attempt <= 3:
  59. attempt = attempt + 1 #Username or/and password is not correct, they have 2 more attempts
  60. print("Your username or password is wrong.")
  61. print("You have 2 more attempts left. ")
  62. print("You have entered 3 attempts and you are locked out,")
  63. print("contact the network office.")
  64. else:
  65. Username_Name()
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. def Username_Correct(): #User inputs correct username and password, therefore, can enter the system
  74. print("You may enter the system.")
  75.  
  76.  
  77.  
  78. intro()
  79. Username_Submit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement