Changes

Jump to navigation Jump to search
400 bytes added ,  09:49, 1 May 2009
Line 81: Line 81:  
import random
 
import random
    +
 +
#Generisize the names of supplys to make it easily editable
 
name = 'Lemonade Stand'
 
name = 'Lemonade Stand'
 +
first_supply = 'cups'
 +
second_supply = 'lemons'
 +
third_supply = 'sugar'
 +
what_selling = 'cups'
    
print 'Welcome to ' + name
 
print 'Welcome to ' + name
Line 162: Line 168:       −
     print "You have "+`stored_cups`+" cups, "+`stored_lemons`+" lemons, and "+`stored_sugar`+" sugar left."
+
     print "You have "+`stored_cups`+ " " + first_supply + ", " +`stored_lemons`+ " " + second_supply + ", and "+`stored_sugar`+ " " + third_supply + " left."
   −
     print "Cup price: $" + `cup_price` + "    Lemon price: $"+ "%.2f" % lemon_price + "    Sugar price: $"+ "%.2f" % sugar_price
+
     print first_supply + " price: $" + `cup_price` + "    " +  second_supply + " price: $"+ "%.2f" % lemon_price + "    " + third_supply + " price: $"+ "%.2f" % sugar_price
    
     expenses = 0
 
     expenses = 0
    
     cost_over = 1
 
     cost_over = 1
 +
 +
 +
    #Checks to make sure you dont go over your bank amount while buying.
    
     while cost_over == 1:
 
     while cost_over == 1:
    
         potential_expense = 0
 
         potential_expense = 0
         in_num = take_input("How many cups")
+
         in_num = take_input("How many " + first_supply)
 
         potential_expense = expenses + (in_num * cup_price)
 
         potential_expense = expenses + (in_num * cup_price)
   Line 181: Line 190:  
             stored_cups += in_num
 
             stored_cups += in_num
 
         else:
 
         else:
             print 'You cant afford that many cups'
+
             print 'You cant afford that many ' + first_supply
    
     cost_over = 1
 
     cost_over = 1
Line 188: Line 197:     
         potential_expense = 0
 
         potential_expense = 0
         in_num = take_input("How many lemons")
+
         in_num = take_input("How many " + second_supply)
 
         potential_expense = expenses + (in_num * cup_price)
 
         potential_expense = expenses + (in_num * cup_price)
   Line 196: Line 205:  
             stored_lemons += in_num
 
             stored_lemons += in_num
 
         else:
 
         else:
             print 'You cant afford that many lemons'
+
             print 'You cant afford that many ' + second_supply
    
     cost_over = 1
 
     cost_over = 1
Line 203: Line 212:     
       potential_expense = 0
 
       potential_expense = 0
       in_num = take_input("How much sugar")
+
       in_num = take_input("How much " + third_supply)
 
       potential_expense = expenses + (in_num * cup_price)
 
       potential_expense = expenses + (in_num * cup_price)
   Line 212: Line 221:     
       else:
 
       else:
           print 'You cant afford that many lemons'
+
           print 'You cant afford that many ' + third_supply
    
     today = min(stored_cups, stored_lemons, stored_sugar)
 
     today = min(stored_cups, stored_lemons, stored_sugar)
Line 233: Line 242:     
     profit = sales * product_price
 
     profit = sales * product_price
     print `sales`+" cups were sold today for $"+ "%.2f" % profit
+
     print `sales`+ " " + what_selling +" were sold today for $"+ "%.2f" % profit
 
     print "You made $"+ "%.2f" % (profit - expenses)+" today."
 
     print "You made $"+ "%.2f" % (profit - expenses)+" today."
 
     bank += profit - expenses
 
     bank += profit - expenses
27

edits

Navigation menu