how to make a shop in python
welcome to my tutorial today i am going to show you the following functions that are needed in making a shop:
so how to start
so for this to work what you want to use is a print statment to welcome people to the shop just like this:
by doing that the program will allow you to print whats inside your quotations when you run it.
so in order for this to actually work you need your money to be called by using something like
so under that print statement from earlier type this right under it:
that 100 is telling you how much gold you have to spend
so when you ask that print statement it wants you to answer the question so for that to happen do this under gold:
this will allow the user to input an answer of yes or no.
then after that what you want to put it this:
so far your code should look like this if you did it correctly:
inputs for shield or sword
so next up is more input statements so under the above code what u need to do is this:
by doing that it allows yu to buy a sword but where it says if gold>= 10: means that if you have less than 10 gold you cant buy it but if u have more than 10 u can buy it.
so after that when u purchased the sword you want to make it take away the gold u spent on the sword so to do that you want to do this:
this will take away gold from your balance and allow you to see how much u have left. now if you dont have enough gold you want to do this:
so now for the shiled you basically want to do the same exact thing:
that should be all you would need and your final code should look like this:
and yeah after that enjoy my tutorial