I am getting this message when using a mimir:
File "./CS902Module6Homework1.py", line 56
print (f"Name is: {Names[foundaposition]} \n{Names[foundaposition]} account has the balance of : {balance[foundaposition]}")
SyntaxError: invalid syntax
The programs works, the line 56 code displays the output correctly.
How is my syntax not correct?
Names=[]
accountnumbers=[]
balance=[]
def populatelist():
position=0
while(position<=1):
yourname= str(input("Please enter a name: "))
Names.append(yourname)
account = int( input("Please enter an account number: " ))
accountnumbers.append(account)
totalbalance = int( input("Please enter a balance: "))
balance.append(totalbalance)
position = position + 1
def findingaccount(accountnumber):
foundposition=-1
position=0
if (len(accountnumbers)>0):
while (position <=1):
if (accountnumber==accountnumbers[position]):
return position
position = position + 1
return foundposition
def menuoptions():
print ("**** MENU OPTIONS ****")
print ("Type P to populate accounts")
print ( "Type S to search for account")
print ("Enter E to exit")
choice = str(input("Please enter your choice: "))
return choice
response=""
while response!= "E":
response = menuoptions()
if response=="P":
populatelist()
elif response=="S":
searchaccount = int(input("Please enter the account number to search: "))
foundaposition = findingaccount(searchaccount)
if ( foundaposition == -1 ):
print ("The account number not found!")
else:
print(f"Name is: {Names[foundaposition]} \n{Names[foundaposition]} account has the balance of :{balance[foundaposition]}")
elif response=="E":
print ("Thank you for using the program")
print ("Bye")
exit
else:
print ("invalid choice. Please try again")