So I have a program that takes the value of an item.. checks the values with price then prints a result. Now my professor is asking for a 4th function that acts as a "data exchange" between the other 3 functions and act like a host for all the values and parameters to reside in. Here is what I currently have:
def quantity(): count=raw_input("How many gearboxes would you like to order? ") return int(count) def subtotal(count): if count<=10: cost=count*100.0 return cost elif count>10 and count<20: cost=(count-10)*80.0+1000.0 return cost elif count>20: cost=(count-20)*70.0+1000.0+800.0 return cost def summary(count, cost): print "="*80 print "%60s %20f %20f" % ("motors",count,cost) print "="*80 items = quantity() sub = subtotal(items) summary(items, sub)
I guess where I am having trouble is knowing where to start creating a function that works as an exchange for the others. Any help is greatly appreciated. Thanks!