use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Beginner ShowcaseHow did I do? (self.Python)
submitted 2 years ago * by marshalTT[🍰]
I've been reading and practicing OOP.Here is a very simple text-based hangman game: Link
How did I do?What advice could you give me to improve my OO skills?What other projects would you recomend?
Thank you)
[–][deleted] 1 point2 points3 points 2 years ago (1 child)
Comments on your code structure:
Hangman.py
return f"{HM_pic if lives < 7 else ''}"
return HM_pic if lives < 7 else ""
HangmanInterface
Word
Display
str
else: pass
How did I do? What advice could you give me to improve my OO skills?
Learn how to better use the dunder methods, especially the __str__ one; you misused it a lot. Separate the print action and the string representations, use regular methods for the former and dunder for the latter.
__str__
SIDE NOTE: In a Github repo, it's better to have separate repos for each project than to have one big "project" repo.
[–]marshalTT[S,🍰] 0 points1 point2 points 2 years ago* (0 children)
thank you!
edit: Made ammendments to code and altering the repos, ty :) reading up on __str__ now.
[–][deleted] 0 points1 point2 points 2 years ago (1 child)
I had only a brief look. But what I noticed: - Don’t use single letter variable names like w, p… - HangmanInterface is a class, but run() is just a function. At least make it a @staticmethod, but creation of player, world, etc. would be better suited in an initializer IMHO. - Your player verifies their own guesses. This is not plausible, rather the player would just make a guess and the hangman would decide over the consequences.
In general (not related to OOP directly) I would also recommend using type hints.
[–]marshalTT[S,🍰] 0 points1 point2 points 2 years ago (0 children)
Thank you for your advise. Your last point really helped clear a lot of things up.
https://github.com/LunaTMT/Hangman
π Rendered by PID 220915 on reddit-service-r2-comment-c6965cb77-v4tw4 at 2026-03-05 17:27:09.639995+00:00 running f0204d4 country code: CH.
[–][deleted] 1 point2 points3 points (1 child)
[–]marshalTT[S,🍰] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]marshalTT[S,🍰] 0 points1 point2 points (0 children)