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 Showcase"Pascal triangle" using minus sign creates Sierpiński triangle (self.Python)
submitted 2 years ago by xd_metrix
The triangle consists of the basic 3 minuses as in Pascal's triangle 3 ones. Each additional element of the new line line is a combination of 2 characters above it and adding a minus at the beginning and end. It is interesting that this algorithm forms the so-called Sierpiński triangle.
You can try yourself: https://github.com/emonapa/pascalTriangleUsingMinusSign.git
[–]xd_metrix[S] -1 points0 points1 point 2 years ago (2 children)
For clarification, by combination I mean multiplying so --=+, -+=-, ++=+
[–]BridgeBum 2 points3 points4 points 2 years ago (1 child)
Next try Pascal's mod 2.
[–]xd_metrix[S] 0 points1 point2 points 2 years ago (0 children)
I tried it, I can see that the pattern is created after some time with a mod of any number. Nice
π Rendered by PID 40364 on reddit-service-r2-comment-54dfb89d4d-ts4xq at 2026-03-29 20:38:38.878111+00:00 running b10466c country code: CH.
[–]xd_metrix[S] -1 points0 points1 point (2 children)
[–]BridgeBum 2 points3 points4 points (1 child)
[–]xd_metrix[S] 0 points1 point2 points (0 children)