Plan B

#memory game
#the user types in an item, stored in a list

#the game is---
#the user is asked to type in something to remember.
#the user is then asked to recall everything they have typed in, doesn't have to be in order.

#task 1 - create an empty list called items

while True:
    toAdd = input("Add a new item to your list: ")
    if toAdd in items:
        print("You already have", toAdd)
        print('added', toAdd)
        #task 2 add the item toAdd to the list items.

    #task 3 - querying the list

    #make a copy of the items list called temp_list
    # make sure to use .copy() - if you just do 'temp_list = items', python will take it literally

    print("name as many items as you can recall.")
    while len(temp_list) > 0:
        answer = input()
        if answer in temp_list:
            #task 4 remove the answer from temp_list.

            print("Incorrect, better luck next time")
            #task 5 print out all the items in items.


Author: D

I'm a student developer living in the UK. I'm on a 1 year placement and am due to finish the final semester of a Computer Games Programming degree in 2015.

Leave a Reply

Your email address will not be published. Required fields are marked *