Jan-22-2021, 02:33 PM
(Jan-22-2021, 02:08 PM)buran Wrote:input
will returnstr
, so you need to comparechoice
with'2'
or convert the user input toint
and then you can compare with2
.
Then to end the loopchoice
must become'exit'
also, I must comment on excessive use of brackets - no need of brackets in cases like("enter")
So your solution did work but when I input an incorrect value but after that, I input the correct value '2' it still says error.
#getpass will hide what the person is typing during the password import getpass def new_entry(): #input the username and password and the website Website = input("Enter the website: ") Username = getpass.getuser() Password = getpass.getpass() #Menu to choose if you want to add, see or remove print(" *************************") print(" /$$ /$$ /$$$$$$ /$$$$$$$ \n| $$ | $$|_ $$_/| $$__ $$\n| $$ | $$ | $$ | $$ \ $$\n| $$$$$$$$ | $$ | $$ | $$\n| $$__ $$ | $$ | $$ | $$\n| $$ | $$ | $$ | $$ | $$\n| $$ | $$ /$$$$$$| $$$$$$$/\n|__/ |__/|______/|_______/ ") print("**************************") print ("1. See the list\n2. Add new entry") choice = int(input("")) c = "enter" while c != ("exit"): if (choice) == (2): new_entry() c = ("enter") #if you select option 2 it will call the new_entry code else: choice = input("ERROR:\nInvalid input: Please type agian\n") #Store this somewhereFeel free to try it out and thanks