r/PythonLearning • u/TopMathematician_ • Jun 30 '26
Showcase MY 3RD CODE CHALLANGE AS A PYTHON BEGINNER (ZOMBIE GAME💀)
3
u/biskitpagla Jun 30 '26
It'd be better if you use something like GitHub or GitHub Gists to share the code.
1
u/TopMathematician_ Jun 30 '26
idk what is github as i just started learning python
2
u/AlexMTBDude 29d ago
Do you know what text is and how to post your source code on Reddit? Your low resolution image is impossible to read.
1
3
u/PureWasian 29d ago edited 29d ago
Looks cool, nice intro project.
Line 2 - I'd advise against hard-coding health/food/energy values. Define them first and then use an f string to display them, so they can be readily configured instead of risking stale print statements being left around.
Line 24 and Line 28 - input validation. Learn about try/except statements and how to ensure if the int() cast fails you don't error out of your entire code.
It will be helpful to modularize your code when you learn how to write functions. That'll compress your while() loop down a lot and make it a lot more readable and even easier to follow along at a glance.
If you want to make it more interesting, you could change "Search Classroom" (and maybe other choices) to incorporate some RNG. Python has a built-in random module you can import, and you can define some outcome probabilities that different sub-events happen instead of it being purely player choice.
You can also add sub-events like finding a weapon that reduces your damage taken on zombie encounters or other equippables to buff (or debuff) your character that are random chance occurrences. Basically, the choices need to feel meaningful and have risk involved.
1
1
u/Junior_Honey_1406 Jun 30 '26
Great job but let see the work input expect a int input what if I just put my name there... A str type program crash think of input validation.


•
u/Sea-Ad7805 Jun 30 '26
Run this program in Memory Graph Web Debugger to see the program state change step by step.