Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #Imports: None
  2.  
  3. #Defs:
  4.  
  5. def userInput1():
  6. x = int(input("Product Number?")
  7. return x
  8. def userInput2():
  9. q = int(input("Quantity?")
  10. return q
  11. def calculations(x,q):
  12. p1 = 2.98
  13. p2 = 4.5
  14. p3 = 9.98
  15. p4 = 4.49
  16. p5 = 6.87
  17. subtotal = q * x
  18. return subtotal
  19. def final(subtotal):
  20. print ("Total:", subtotal)
  21. def loop():
  22. print ("Do you want to continue? (yes/no)")
  23. cont = raw_input()
  24. if cont = 'yes':
  25. main()
  26. return
  27. else:
  28. final()
  29.  
  30. def main()
  31. x = userinput()
  32. subtotal = calculations()
  33. final(subtotal)
  34.  
  35. #Driver:
  36. main()
  37.  
  38. Product number?: 1
  39. Quantity?: 2
  40. Continue?(yes/no): yes
  41. Product number?: 2
  42. Quantity?: 5
  43. Continue?(yes/no): yes
  44. Product number?: 3
  45. Quantity?: 3
  46. Continue?(yes/no): yes
  47. Product number?: 4
  48. Quantity?: 1
  49. Continue?(yes/no): no
  50. Total: $62.89
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement