[英]Flowchart nested for-loop
I have this code and I tried to do a flowchart but I have no clue how to make one.我有这段代码,我试图做一个流程图,但我不知道如何制作一个。 All of my Flowchart I made, don't make any sense.
我制作的所有流程图都没有任何意义。
Could anyone of you guys please help me out???有谁能帮帮我吗???
import turtle
STARTING_X, STARTING_Y = 350, 200
turtle.penup()
turtle.width(2)
turtle.setheading(180)
turtle.sety(STARTING_Y)
for a in range(1, 8):
turtle.penup()
turtle.setx(STARTING_X)
for b in range(a):
turtle.pendown()
turtle.circle(25)
turtle.penup()
turtle.forward(60)
turtle.sety(turtle.ycor() - 60)
turtle.done()
The code:编码:
# part 1
import turtle
STARTING_X, STARTING_Y = 350, 200
turtle.penup()
turtle.width(2)
turtle.setheading(180)
turtle.sety(STARTING_Y)
# part 2
for a in range(1, 8):
turtle.penup()
turtle.setx(STARTING_X)
for b in range(a): # part 3
turtle.pendown()
turtle.circle(25)
turtle.penup()
turtle.forward(60)
turtle.sety(turtle.ycor() - 60)
turtle.done()
Part 1:第1部分:
Part 2:第2部分:
Part 3:第 3 部分:
runs a
times跑
a
一次
turtle pendown (drawing)乌龟笔下(绘图)
drawing a circle画一个圆圈
turtle penup (not drawing)乌龟笔(不画)
go forward with 60 (in this case, lower the x position with 60 because of the direction in part 1) go 向前 60(在这种情况下,由于第 1 部分中的方向,将 x position 降低 60)
* ** *** **** ***** ****** ******* ********
But circles instead of stars但是圆圈而不是星星
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.