Created
September 26, 2016 18:56
-
-
Save MrDMurray/e19dc7e4f4f36378f5168997708a1666 to your computer and use it in GitHub Desktop.
STJLOL-DMU-Lists: The pokeshop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bag = ['pokeball',"pokedex"] #makes a list with two items called bag | |
print("Welcome to the pokeshop!") | |
print("Let's see what's in your bag") | |
print (bag) #prints out what items are in the bag starting off | |
while True: #loops this part till a purchase is made | |
print("What would you like to buy? We have the following in our shop") | |
buy_choice=input("ultraball, raspberry ") #the user makes a choice | |
if buy_choice== "ultraball": | |
bag.append("ultraball") #adds a new list item "ultraball" | |
break #breaks out of the loop, done shopping. | |
elif buy_choice== "raspberry": | |
bag.append("raspberry") #adds a new list item "raspberry" | |
break #breaks out of the loop, done shopping. | |
else: | |
print("We don't sell eh... "+ buy_choice + ", sorry!") | |
print("Great choice. Thanks for shopping with us!. Let's see what's in your bag now..") | |
print (bag) #prints the updated contents of the bag | |
""" | |
OUTPUT LOOKS LIKE THIS: | |
>>>Welcome to the pokeshop! | |
Let's see what's in your bag | |
['pokeball', 'pokedex'] | |
What would you like to buy? We have the following in our shop | |
ultraball, raspberry | |
>>>user type in the word.. "ultraball" | |
Great choice. Thanks for shopping with us!. Let's see what's in your bag now.. | |
['pokeball', 'pokedex', 'ultraball'] | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment