So, I've looked at similar questions about this topic, but either I haven't really understood or they haven't been applicable to my case. I have a code that I am writing that calculates whether the user can afford a number of bananas. Here's the code:
print("---BANANA AFFORDABILITY CALCULATOR---")
print(" ")
print("...")
print(" ")
print("Hello there! I am here to tell you whether you can afford the bananas you want to buy!")
bananas = float(input("How many bananas do you want to get? "))
total_price = bananas * .23
if bananas < 1:
print("Nonsense. You must buy bananas.")
elif bananas > 1:
print(" ")
print("let's see:")
money = input("How much money do you have? ")
print("Dope.")
if bananas == 1:
print("So, one banana costs $" + total_price "...")
elif bananas > 1:
print("So, " + bananas + "cost $" + total_price + "..."
if float(money) < total_price:
print("You sadly cannot afford the bananas.")
elif float(money) == total_price:
print("You can just barely afford the bananas!")
elif float(money) > total_price:
print("You could practically be SWIMMING in this potassium!!!")
Whenever I try to run it, I get an error message (not in the shell) that says "SyntaxError: Invalid Syntax". It doesn't point to a specific line and I don't know what the problem is. Can anyone help me with this?
Comments
Post a Comment