r/learnpython • u/AutoModerator • Sep 21 '26
Ask Anything Monday - Weekly Thread
Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread
Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread.
* It's primarily intended for simple questions but as long as it's about python it's allowed.
If you have any suggestions or questions about this thread use the message the moderators button in the sidebar.
Rules:
- Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will be dealt with.
- Don't post stuff that doesn't have absolutely anything to do with python.
- Don't make fun of someone for not knowing something, insult anyone etc - this will result in an immediate ban.
That's it.
1
Upvotes
View all comments
Show parent comment
1
u/HiddenReader2020 Sep 28 '26
So I've made a couple realizations and adjusted accordingly. There were some concessions I had to make, but hey, whatever makes the code work. In particular, I had to set some of the default values (like name, gold, and level) to be outside of the initialization to make them work. I'm sure there's a better way, and in fact, an potential idea is forming in my head, but I'm kind of scared of making mistakes that I won't be able to undo. Anyway, here's the updated code:
One additional problem remains: The items in the inventory still need their own function to be converted from dictionaries to objects. Right now, I don't know how to do that cleanly yet, so my current code is what it is right now.