Can anyone find my error?


Im trying to ask for user input on 3 items in a store and provide a receipt including tax subtotal and shipping etc. here it is… any advice on how to fix my error as well? thanks!!!

#Tadd Trumbull
#Purpose:To find the total, sub total and tax of all of the items in the wish list
#Numeric input
def main():
    unoVar = int(input("What is the cost of the first value?"))
    unoVar2 =int(input("What is the cost of the second value?"))
    unoVar3 = int(input("What is the value of the third value?"))
    print("Time to shop on amazon!")
    print("Your order:")
	print("Item									Cost")
	print("COD BO2								$" + unoVar + ".")
	print("Xbox one								$" + unoVar2 + ".")
	print("Lamp									$" + unoVar3 + ".")
	subtotal = unoVar + unoVar2 + unoVar3
	tax = subtotal * 0.07
	shipping = 5.99
	order_total = tax + subtotal + shipping
	print("		Subtotal:                       $ + subtotal + ".")
	print("		Tax:							$ + tax ".")
	print("		Shipping:						$ + shipping ".")
	print("     Order total:					$ + order_total ".")


if you want to include so many spaces use format:

which support padding, which really makes life easier. If you have done that, let me know if you need further help (and post an updated version of your code


the problem with that is im in a class and my teacher is off. I am in a beginner class so i dont even know what formats are… Would you mind explaining it a little simpler for me? :slight_smile:


its a function, it can help you make your text look better (it supports padding for example). I included a link to a webpage which explains it in detail?


using format prevent this kind of mistakes:

print("		Subtotal:                       $ + subtotal + ".")

you miss a " between $ and +

when i try to run your code, it also says invalid combination of tabs and spaces. What IDE/text-editor are using? use soft tabs (tabs are converted to spaces), makes code more portable

the function call (last line) executes the function, as such it should be placed outside/after the function. Nesting is determined by indent


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.