Ask coding questions

← Back to all posts
How to make inventory system
Bookie0

Hello,

How do you make an inventory system in Python? I’m thinking of having the inventory only contain 1 item in the start, like the fists. But then, as the character progresses in the game, they can get more items.

So the question is, first of all, how do you make that inventory, and second of all, how would you add items inside that inventory, and third of all, how do you print the item that the user can choose with an input (so like i would show what items they have, and the user then choose out of the items which one they want to use)

Please bear in mind I am a kinda intermediate coder, so I might require you to explain.

Thank you very much in advance!

Edit: someone already helped me but if you have tips why not

Voters
24aortega
Bookie0
Comments
hotnewtop
CoolJames1610

yeah just use dicts

[deleted]

Here is a less complicated version (For me, Im kinda a noob)

Bookie0

Thanks for the suggestion @CarlosRosiles

CodeLongAndPros

You could do:

Bookie0

Thanks for the suggestion @CodeLongAndPros

CodeLongAndPros

@Bookie0 Sure.