Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Imports: None
- #Defs:
- def userInput1():
- x = int(input("Product Number?")
- return x
- def userInput2():
- q = int(input("Quantity?")
- return q
- def calculations(x,q):
- p1 = 2.98
- p2 = 4.5
- p3 = 9.98
- p4 = 4.49
- p5 = 6.87
- subtotal = q * x
- return subtotal
- def final(subtotal):
- print ("Total:", subtotal)
- def loop():
- print ("Do you want to continue? (yes/no)")
- cont = raw_input()
- if cont = 'yes':
- main()
- return
- else:
- final()
- def main()
- x = userinput()
- subtotal = calculations()
- final(subtotal)
- #Driver:
- main()
- Product number?: 1
- Quantity?: 2
- Continue?(yes/no): yes
- Product number?: 2
- Quantity?: 5
- Continue?(yes/no): yes
- Product number?: 3
- Quantity?: 3
- Continue?(yes/no): yes
- Product number?: 4
- Quantity?: 1
- Continue?(yes/no): no
- Total: $62.89
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement