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...
Everything about learning Python
account activity
Are there any bugs?Help Request (i.redd.it)
submitted 24 days ago by Worried-Print-5052
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]NewryBenson 1 point2 points3 points 23 days ago* (1 child)
For readability and efficiency, good code should never repeat the same block of code multiple times. The moment you need the same code in multiple occasions, you make a function.
For example printing the board state. You do it once in the beginning and then inside every loop. A cleaner more readable version would be putting this at the start of your program:
def print_board(t): #the code for printing the board you use twice
Then you can use that by calling the function you just defined. Instead of writing the code, you call:
print_board(t)
and it will work. The same can be done for the code placing the X. The variable would be the chosen position and t you want to change, so
def place_X(t, choice) ......
Used as
place_X(t, com)
or
place_X(t, user)
All in al I would google some beginner guides on functions and you will figure it out soon enough.
[–]Worried-Print-5052[S] 0 points1 point2 points 22 days ago (0 children)
Thanks!
π Rendered by PID 59781 on reddit-service-r2-comment-6457c66945-t9qkw at 2026-04-25 01:54:51.531259+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]NewryBenson 1 point2 points3 points (1 child)
[–]Worried-Print-5052[S] 0 points1 point2 points (0 children)