Created
August 27, 2021 07:05
-
-
Save ryanwoodsmall/cc19748035a152489babafb34ad8c1b5 to your computer and use it in GitHub Desktop.
sierpinksi.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# via: https://blog.pimaker.at/texts/rvc1/ | |
def s(n): | |
d=["*"] | |
for i in range(n): | |
sp=" "*(2**i) | |
d=[sp+x+sp for x in d] + [x+" "+x for x in d] | |
return d | |
print("\n".join(s(4))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment