Lemonade Stand: Difference between revisions
| Line 89: | Line 89: | ||
print 'Welcome to ' + variables[0] | print 'Welcome to ' + variables[0] | ||
#Random weather event, if its a hot day all stock will sell, | |||
# if its a normal day, 90% will sell, and if its a raining day 80% will sell | |||
def weather_Change( ): | def weather_Change( ): | ||
| Line 100: | Line 102: | ||
elif weather == 1: | elif weather == 1: | ||
print "Tomorrow looks to be very hot" | print "Tomorrow looks to be very hot" | ||
#Format the input text, and make it return a 0 if input is incorrect | |||
def take_input(text, default = 0): | def take_input(text, default = 0): | ||
try: | try: | ||
| Line 111: | Line 114: | ||
return in_text | return in_text | ||
#Declare a random event, More events can be added easily by building a new case statment | |||
def random_Event(): | def random_Event(): | ||
global stored_sugar, stored_lemons, stored_cups | global stored_sugar, stored_lemons, stored_cups | ||
| Line 136: | Line 140: | ||
#Decreases currently the | #Decreases currently the supply's 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 236: | Line 240: | ||
# | # Find the lowest amount of supplys, and make that many of lemonade that day | ||
sales = max(min(stored_cups, stored_lemons, stored_sugar),0) | sales = max(min(stored_cups, stored_lemons, stored_sugar),0) | ||
| Line 272: | Line 269: | ||
else: | else: | ||
#If you didnt lose money that day, play the small money game to put away your change | |||
#If you put away change right, you get to keep the profit, otherwise you lose it | |||
print "You go to put profits away" | print "You go to put profits away" | ||
| Line 283: | Line 283: | ||
print "Current funds: $"+ "%.2f" % bank | print "Current funds: $"+ "%.2f" % bank | ||
#Decrease the supply's by 10% | |||
#Warn for the next days weather | |||
supply_Decay() | supply_Decay() | ||