How to explain this code?
elif(choice=="3"):#Search for a user
      name =input("Enter the name of account: ")
      surname =input("Enter the surname of the account: ")
      Â
      accountExist=False
      for acc in accounts:
        if acc.getName()==name and acc.getSuname()==surname:
          acc.displayAccountInformation()
          print("")
          accountExist=True
      if accountExist==False:
        print("\nThe account does not exist.\n")
elif(choice=="3"):#Search for a user
#Ask user to input name
name =input("Enter the name of account: ")
#ask user to input surname
surname =input("Enter the surname of the account: ")
#set accountExit to False
accountExist=False
#check every value in accounts
for acc in accounts:
#Compares input values with the one in db and if they are the same
if acc.getName()==name and acc.getSuname()==surname:
#displays account information by callin displayAccountInformation()
acc.displayAccountInformation()
print("")
#accountExist changes to False to stop the loop if account exist
accountExist=True
#set accountExist to false if account does not exist and print the error
if accountExist==False:
print("\nThe account does not exist.\n")
Comments
Leave a comment