Changes

139 bytes added ,  11:28, 1 May 2009
Line 82: Line 82:     
#Generisize the names of supplys to make it easily editable
 
#Generisize the names of supplys to make it easily editable
name = 'Lemonade Stand'
+
#[0] = name of the stand, [1] = first supply, [2] = second supply, [3] = third supply, [4] = the object that is being sold
first_supply = 'cups'
+
variables = ['Lemonade Stand','cups','lemons','sugar','cups']
second_supply = 'lemons'
  −
third_supply = 'sugar'
  −
what_selling = 'cups'
     −
print 'Welcome to ' + name
+
print 'Welcome to ' + variables[0]
      Line 125: Line 122:  
     print ""
 
     print ""
    +
 +
#Decreases currently the supplys by 10% each day
 
def supply_Decay():
 
def supply_Decay():
 
     global stored_sugar, stored_lemons, stored_cups
 
     global stored_sugar, stored_lemons, stored_cups
Line 167: Line 166:       −
     print "You have "+`stored_cups`+ " " + first_supply + ", " +`stored_lemons`+ " " + second_supply + ", and "+`stored_sugar`+ " " + third_supply + " left."
+
     print "You have "+`stored_cups`+ " " + variables[1] + ", " +`stored_lemons`+ " " + variables[2] + ", and "+`stored_sugar`+ " " + variables[3] + " left."
   −
     print first_supply + " price: $" + `cup_price` + "    " +  second_supply + " price: $"+ "%.2f" % lemon_price + "    " + third_supply + " price: $"+ "%.2f" % sugar_price
+
     print variables[1] + " price: $" + `cup_price` + "    " +  variables[2] + " price: $"+ "%.2f" % lemon_price + "    " + variables[3] + " price: $"+ "%.2f" % sugar_price
    
     expenses = 0
 
     expenses = 0
Line 181: Line 180:     
         potential_expense = 0
 
         potential_expense = 0
         in_num = take_input("How many " + first_supply)
+
         in_num = take_input("How many " + variables[1])
 
         potential_expense = expenses + (in_num * cup_price)
 
         potential_expense = expenses + (in_num * cup_price)
   Line 189: Line 188:  
             stored_cups += in_num
 
             stored_cups += in_num
 
         else:
 
         else:
             print 'You cant afford that many ' + first_supply
+
             print 'You cant afford that many ' + variables[1]
    
     cost_over = 1
 
     cost_over = 1
Line 196: Line 195:     
         potential_expense = 0
 
         potential_expense = 0
         in_num = take_input("How many " + second_supply)
+
         in_num = take_input("How many " + variables[2])
 
         potential_expense = expenses + (in_num * cup_price)
 
         potential_expense = expenses + (in_num * cup_price)
   Line 204: Line 203:  
             stored_lemons += in_num
 
             stored_lemons += in_num
 
         else:
 
         else:
             print 'You cant afford that many ' + second_supply
+
             print 'You cant afford that many ' + variables[2]
    
     cost_over = 1
 
     cost_over = 1
Line 211: Line 210:     
       potential_expense = 0
 
       potential_expense = 0
       in_num = take_input("How much " + third_supply)
+
       in_num = take_input("How much " + variables[3])
 
       potential_expense = expenses + (in_num * cup_price)
 
       potential_expense = expenses + (in_num * cup_price)
   Line 220: Line 219:     
       else:
 
       else:
           print 'You cant afford that many ' + third_supply
+
           print 'You cant afford that many ' + variables[3]
    
     today = min(stored_cups, stored_lemons, stored_sugar)
 
     today = min(stored_cups, stored_lemons, stored_sugar)
Line 238: Line 237:  
     stored_lemons -= sales
 
     stored_lemons -= sales
 
     stored_sugar -= sales
 
     stored_sugar -= sales
     print `sales`+" cups made for $"+ "%.2f" % expenses
+
     print `sales`+ ' ' + variables[4]+ " made for $"+ "%.2f" % expenses
    
     profit = sales * product_price
 
     profit = sales * product_price
     print `sales`+ " " + what_selling +" were sold today for $"+ "%.2f" % profit
+
     print `sales`+ " " + variables[4] +" 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