Untitled
unknown
plain_text
2 years ago
845 B
7
Indexable
Sure! Here's a unique and fun program that generates and prints a colorful fractal pattern:
```python
from turtle import *
def fractal(length, angle):
if length < 1:
return
else:
forward(length)
left(angle)
fractal(length - 1, angle)
def main():
setup(width=800, height=800)
bgcolor("black")
speed(0)
color("white")
hideturtle()
up()
goto(-100, 200)
down()
fractal(200, 120)
done()
if __name__ == "__main__":
main()
```
When you run this code, it will open up a turtle graphics window with a black background. The turtle will then draw a colorful fractal pattern using a recursive algorithm. You can modify the `fractal` function parameters to adjust the complexity of the pattern.
Give it a try and see the unique and mesmerizing pattern it generates!Editor is loading...