Skip to content
Sign upLog in
← Back to Community

Patterns in Python

Profile icon
cheezburstpizza

How can we make number patterns in python? Can someone explain code to me? codes such as/similar to this. Include explanation in comments(#) of python .I want to know about loop in a loop ,its functioning.
1
1 2
1 2 3


And

4 3 2 1
4 3 2
4 3
4

Voters
Profile icon
RubyMcCabe
Profile icon
cheezburstpizza
Comments
hotnewtop
Profile icon
RhinoRunner

what do you mean by "patterns"? You could mean a million things. Please add more information to your question.

Profile icon
Codemen

Example:

import turtle spiral = turtle.Turtle() spiral.pencolor("blue") for i in range(40): spiral.forward(i * 10) spiral.right(144) turtle.done()

the code basically represents a dot of some sort making a star repetitively. The numbers, [144, 40, 10] are the positions it stops at. the letters, [i], represents the "thing" in an equation \ give my recent post a thumbs up if this helped!