if i enter the wrong credentials once, it wont verify the credentials again, i think because its not checking acc_number and acc_pass anymore after,enter image description here
Asked
Active
Viewed 25 times
-3
-
You need to put `global ...` inside the `log_in` function. Also, you should read and understand what those gray lines in your IDE mean. Lastly, [do not upload images of code/errors when asking a question.](//meta.stackoverflow.com/q/285551) – enzo Nov 02 '21 at 22:39
1 Answers
0
The login function does not return anything, besides taking input. Beneath some pseudo code I just typed on mobile. But then you have an example of how you can do the whole login within 1 function.
Also be carefull with int(). If you wish to change it later to actual names and such (or passwords with symbols) that kills the script.
def logon()
account = int(input('give login credentials'))
password = int(input('give password'))
while account != 123 or password != 123:
account = input('invalid login, please submit credentials again')
password = input('please submit password again')
print('you logged in')
logon()

TheRealShadow
- 61
- 4
-
Like stated it's pseudo written. For his current usercase you should specify Integer, but for later cases you dont wish this but instead of previous inputs or from actual data from a database. I'll edit it once more for clarity – TheRealShadow Nov 02 '21 at 23:16