Start New Discussion within our Software Development Community

Ok some of you might've seen my post from yesterday about the weekend challenge game thing i'm doing with a friend. The link to my post yesterday is http://www.daniweb.com/software-development/python/threads/416633/1777493#post1777493
Anyway, now im trying to make a shop type thing but im having trouble writing a script (or whatever you call it lol) for buying something from the shop and selling something to the shop. Here's what I have so far but its all messed up and doesn't work.

#go to the shop
    elif choice == "2":
        def shop():
            print("Welcome to the Shop! We're a little low on supplies right now. Sorry! Here's what we have in stock:")
            print(shop)
            buyoption = input("Would you like to purchase something <y/n>: ")
            if buyoption == "y":
                def buy(message):
                    item = input("Which item would you like to buy: ")
                    if item == shop[0:1]:
                        shop[0:1] += inventory
                        del shop[0:1]

Your help would be greatly appreciated. I'm still a very beginner so I don't know when to use functions or what to write. Functions confuse me! Lol! I know the code is REALLY MESSED UP but if you could help me solve my many problems lol I'd really appreciate it! Thanks!

What you think the slice of first elements of function shop to be like at line 10, and how is the definition of buy function depending on value of buyoption, that you should define it in if branch of definition of elif branch of other condition unknow to us.

Where will these functions be used?

Also I do not remember of any error called "Does not work", is it surely error you are getting? :icon_evil:

This question has already been answered. Start a new discussion instead.