So basically I don't understand why my code is giving me this error, I tried looking it up, but I do not understand the error or how it affects me. This is my code for a simple shop simulator.
isBuying = True
#Create a map for our store's inventory. Each item in our store will have a string name and a floating point number for its price.
store = [('arrows', 20.00), ('bombs', 40.00), ('heart container', 120.00),
('sword', 100.00), ('potion', 15.00)]
#Define a function to print out the store's inventory. This function will take in an inventory.
def PrintStore(inventory):
#For every item in the inventory, it will print out the item name and price in our formatted way.
for item in inventory:
print(' ' * 4 + item[0] + '.' * 3 + ' ' * 4 + str(item[1]))
while isBuying:
#Use our function to print out our store's inventory.
PrintStore(store)
#Ask the user what they would like to buy and store the input in a variable. Lowercase it to prevent case sensitivity.
input = input('What would you like to buy?\n')
input = input.lower()
#For every item in our store, check to see if our input is equal to the item's name. If it is, print out the item's price.
for item in store:
if input == item[0]:
print(f'That will be {item[1]} dollars.')
answer = input('Would you like to continue shopping?\n')
answer = answer.lower()
if answer == 'n' or 'no':
isBuying = False
The error is on line answer = input('Would you like to continue shopping?\n')
and the error is TypeError: 'str' object is not callable