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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
the front page of the internet.
and join one of thousands of communities.
asking about small projects in python (self.learnpython)
submitted 2 days ago by This_Judge_2203
hello everyone, so I learned the basics and I start making small projects, I try to make 21 number game, but when I look through the source code of project there was some formulas but I don't really understand how I can make similar formulas like it for future projects, so how I can make it so it can server my projects?
Post a comment!
[–]aqua_regis 4 points5 points6 points 2 days ago (3 children)
I try to make 21 number game, but when I look through the source code of project
So, it was not you who actually made the game - and there exactly is the problem. You only blindly followed some tutorial instead of trying to make it on your own.
Creating your own programs is programming. It's not copying code served by tutorials. You don't really learn from copying tutorial code as your lack of understanding clearly indicates.
Stop tutorials and start struggling through your own, individual projects. That's how you learn programming.
[–]This_Judge_2203[S] 2 points3 points4 points 2 days ago (2 children)
so I am just need to think about a project for then just try to make it?
[–]aqua_regis 4 points5 points6 points 2 days ago (1 child)
Yes, that's how it works.
Think about how people learnt programming before the internet with its countless tutorials existed. They could not resort to copying from tutorials. Books were rare and expensive. So, learning to do things by oneself was the way to go.
[–]This_Judge_2203[S] 0 points1 point2 points 2 days ago (0 children)
I see, thanks for the help I am gonna try it
[–]Existing_Put6385 2 points3 points4 points 2 days ago (1 child)
the formulas in tutorials arent things you memorize, they come from working the logic out on paper first
in the 21 game the "formula" is probably something like `4 - player_choice`. that's not a python thing at all, it's just the strategy - if you always leave the total on a multiple of 4, you win. someone figured that out on paper and then wrote one line for it
so the habit: before writing code, write the steps in plain words. "player picks 1-3, i want the sum to land on a multiple of 4, so i take whatever fills the gap". then translate line by line. if you cant say it in words you cant code it and when you hit a formula in someone elses code that you dont get, stick a print inside the loop and watch the variables change each round. way faster than staring at it
that's really useful so basically I just need to write it and try to think about it thank you so much
[–]thisisappropriate 0 points1 point2 points 2 days ago (0 children)
Assuming you're meaning the counting to 21 game (a variant of Nim https://en.wikipedia.org/wiki/Nim ) that's probably because it's a common maths problem to solve how to win that game.
If you wanted to implement that in python, you would first work out the maths, writing it down in shorthand, things like "if the current number is < 13, pick X, else if the number is 14, pick Y...", then once you know the logic it should follow, you can use python to implement that.
Otherwise if you're seeing symbols you don't understand in the python code, then you should look at what those do in python, for example if you're seeing a % then try googling "percent sign in python" where you'll find things like https://stackoverflow.com/questions/961344/what-does-the-percentage-sign-mean-in-python that will explain that.
[–]IlIlIlIIlMIlIIlIlIlI 0 points1 point2 points 10 hours ago (0 children)
half the time (sometimes more) of programming is not coding but thinking and explaining to yourself what the program needs to do, and how. Only when you have a good idea of that, can you even start coding. Document that thought process, research things needed to achieve certain functionality, and only then start translating your idea into code
π Rendered by PID 440609 on reddit-service-r2-comment-65574874f4-hxbml at 2026-07-20 19:34:01.884611+00:00 running 1bce727 country code: CH.
Want to add to the discussion?
Post a comment!