Aug-27-2020, 02:14 PM
I'm using a code with a while loop:
Please enter the new ID1
Please enter the new password:numbers0123
That is a strong password
Please enter your selection:4
Rather than going to the normal non-running terminal it just has a blank line underneath. Can anyone help with this?
def main():
print("1) Create a new user ID") # prints this menu
print("2) Change a password")
print("3) Display all user ID's")
print("4) Quit")
print()
choice = int(input("Please enter your selection:")) # asks user for their selection
try_again = True
while try_again == True:
if choice == 1:
tmp = get_data() # gets tmp list from get_data
New_ID = create_ID(tmp) # gets New_ID from create_ID
password = create_password() # gets password
new_record = New_ID + "," + password # creates entry string
tmp.append(new_record) # adds string to the end of tmp
file = open("ID+Passwords.csv","w") # opens csv file in write mode
for row in tmp:
file.write(new_record) # writes every row of the list to the csv file
file.close # closes the file and saves the changes
choice = int(input("Please enter your selection:")) # asks user for their selection
elif choice == 2:
tmp = get_data()
New_ID = create_ID(tmp)
change_password(New_ID,tmp)
choice = int(input("Please enter your selection:")) # asks user for their selection
elif choice == 3:
tmp = get_data()
display(tmp)
choice = int(input("Please enter your selection:")) # asks user for their selection
elif choice == 4:
try_again == False
else:
choice = int(input("Incorrect choice please select a choice from the list:"))However when I select option 4 the loop isn't closing properly, this is what my terminal looks like: Please enter the new ID1
Please enter the new password:numbers0123
That is a strong password
Please enter your selection:4
Rather than going to the normal non-running terminal it just has a blank line underneath. Can anyone help with this?
