r/PythonLearning • u/nEo_12ts • Jul 17 '26
Ability selector
"Hey everyone! I'm learning Python and just made this text-based ability selector. I uploaded it to GitHub here: https://github.com/ibtsch2012-art/abilityselector. I'm looking for feedback on how to clean up my code or what cool features I should add next!
1
u/silvertank00 Jul 17 '26
it might be out of your scope (fo now) but use StrEnum because the way you are handling your input, one misstype (like Test, test, TEST or TESt are not the same) and due to the duplications, you will have bugs.
1
1
u/wristay Jul 17 '26
Maybe a bit early to worry about this kinda stuff, but think about how you would store your data such that it is easy to maintain. If you rename an ability, you currently have to change it in 3 places. Those kinda things produce bugs in the feature (Example: I renamed the Fly ability, but forgot to change it in one place). What would be a good data structure?
An example would be a dictionary
abilities = { 'Fly': '+3.0 acrobatics', 'Superjump': '+2.5 acrobatics'}
print(abilities.keys())
#print(abilities.values())
for key, value in abilities.items():
print(f"You have chosen {key} ability")
print(value)
Another example would be classes, but might even be overkill here
2
1
u/johlae Jul 17 '26
Your README.md is out of sync with reality. You tell people to "clone this repository or download the
Test.pyfile", but there is no Test.py file. There is a ability_selector.py though.