Aug-19-2018, 05:00 PM
The way to do it is with a dictionary:
You may want to look at the collections module, specifically defaultdict. It provides an easy way to do this.
inventory = {'food': [], 'tools': [], ...}
. By using strings for the keys, this allows you to use the user's input as a key: inventory[cato].append(item)
.You may want to look at the collections module, specifically defaultdict. It provides an easy way to do this.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures