Lemonade Stand: Difference between revisions
Epsilon748 (talk | contribs) |
No edit summary |
||
| Line 21: | Line 21: | ||
Bargaining/haggling<br> | Bargaining/haggling<br> | ||
Potential use of network, competitive or cooperative modes<br> | Potential use of network, competitive or cooperative modes<br> | ||
==Code so far== | |||
def supplyReduce(): | |||
global cups, lemons, ice | |||
if cups != 0: | |||
cups -= 1 | |||
if lemons != 0: | |||
lemons -= 1 | |||
if ice != 0: | |||
ice -= 1 | |||
print "some of your supplys was stolen by ants!" | |||
def makeStuff(): | |||
global cups, lemons, ice | |||
made = min(cups, lemons, ice ) | |||
cups -= made | |||
lemons -= made | |||
ice -= made | |||
print "You made " + str(made) + " cups of lemonade" | |||
name = 'lemonade stand' | |||
cups = 0 | |||
lemons = 0 | |||
ice = 0 | |||
today = 0 | |||
daysToPlay = 0 | |||
print "Welcome to " + name | |||
daysToPlay = input("How many days would you like to play for: ") | |||
while today <= daysToPlay: | |||
print " " | |||
print "You have" | |||
print "cups: " + str(cups) | |||
print "lemons: " + str(lemons) | |||
print "ice: " + str(ice) | |||
print " " | |||
try: | |||
cupsToAdd = input("How many cups do you want to buy? ") | |||
cups += cupsToAdd | |||
lemonsToAdd = input("How many lemons do you want to buy? ") | |||
lemons += lemonsToAdd | |||
iceToAdd = input("How much ice do you want to buy? ") | |||
ice += iceToAdd | |||
except: | |||
print "dont break my program" | |||
print " " | |||
makeStuff() | |||
supplyReduce() | |||
today += 1 | |||