r/pythonhelp • • Sep 17 '21

HOMEWORK Need help fixing this syntax error.

I’m getting a syntax error at the print part and I don’t know why. I started coding recently and I’m a noob. I would appreciate any help.

item1 = (input("Please enter the price of the first item : ")) item2 = (input("Please enter the price of the second item : ")) item3 = (input("Please enter the price of the third item : ")) item4 = (input("Please enter the price of the fourth item : ")) item5 = (input("Please enter the price of the fifth item : ")) total = item1 + item2 + item3 + item4 + item5 salesTax = 0.7 subTotal = (total + (total * salesTax) print = total, salesTax, subTotal

3 Upvotes

1 comment sorted by

1

u/skellious Sep 18 '21 edited Sep 18 '21

print is a function, you need to do

print(total, salesTax, subTotal)

I think the issue though is you open a bracket you don't close here:

subTotal = (total + (total * salesTax) 
print = total, salesTax, subTotal

Instead do:

subTotal = total + (total * salesTax) 
print(total, salesTax, subTotal)

Also, it won't stop your program working but you don't need the extra brackets around input

So do:

item1 = input("Please enter the price of the first item : ")