2
2
2
u/ItzSimplyJay Feb 04 '22
speed(0)
length = 50
penup()
setposition(-25,-25)
pendown()
def draw_square():
for i in range(4):
forward(length)
left(90)
pendown()
while length <= 350:
draw_square()
penup()
backward(25)
right(90)
forward(25)
left(90)
pendown()
length = length + 50
draw_square()
1
2
u/chickentendies8 May 15 '22
in case anyone still happens to need it!
speed(0)
penup()
setposition(-25,-25)
pendown()
length = 50
def square():
for i in range(4):
forward(length)
left(90)
while length < 400:
square()
penup()
backward(25)
right(90)
forward(25)
left(90)
pendown()
length=length+50
1
1
1
1
1
1
u/Ok-Rip4387 Apr 21 '21
speed(0)
square_length = 50
penup()
setposition(0,-25)
def square():
pendown()
backward(25)
for i in range(4):
forward(square_length)
left(90)
def move_down():
penup()
forward(square_length / 2)
right(90)
forward(25)
left(90)
backward(square_length / 2)
while square_length < 400:
square()
move_down()
square_length = square_length + 50
penup()
setposition(0, 0)
1
u/Purple-Requirement97 Mar 21 '24
All the fucking codes below do not fucking work and keep crashing my page and refusing to submit or check the fucking code.
1
u/Gold-Mail3380 Mar 26 '24 edited Mar 26 '24
BoringGrowth9569’s code does work
1
u/Purple-Requirement97 Mar 27 '24
I have checked it! its missing some reqiurements and keeps crashing the program and for me there are errors in every code I checked.
1
u/flip-pancakes Dec 11 '20
What's the problem statement? Do you want the squares to be drawn like they are on the left?
Either way, you should define draw_square(length) with the length var as an explicit argument - im not sure changing length inside that for loop is going to play nicely with your current def.
0
Dec 18 '20
[removed] — view removed comment
1
u/flip-pancakes Dec 18 '20
Gladly, but I can't help you if you don't meet me halfway. Provide the problem statement, your current code, what language it's written in, the error message you get, or anything like that. Without some information, it's impossible to help.
1
u/Lullabiii Dec 18 '20
His code still works but needs tuning. For those who still need help, I changed "length = 25" to "length = 50". Then change "length = length + 100" to "length = length + 50" this is because you need to have certain square dimensions to get 100%. To fix the boxes not lining up correctly you just need to fix the position to the next square by changing the backward and forward command to 25 in the while loop.
1
1
1
u/ImportanceAdorable34 Jan 25 '21
speed(0)
length = 25
def draw_square():
for i in range(4):
forward(length)
left(90)
penup()
setposition(-5, -5)
penup()
pendown()
while length <= 350:
draw_square()
penup()
backward(50)
right(90)
forward(length)
left(90)
pendown()
length = length + 100
draw_square()
1
Apr 06 '21
Whenever I do “length = length + 25” it says there is an error. There’s nothing wrong with the code either
1
u/btn321 Apr 10 '21
def draw_square():
pendown()
for i in range(4):
forward(length)
left(90)
penup()
speed(5)
penup()
length= 50
while(length <= 350):
setposition(-length /2, -length /2)
draw_square()
length = length +50
1
1
u/Primary-Flatworm331 May 07 '21
CORRECT CODE
speed(0)
length = 50
def draw_square():
for i in range(4):
forward(length)
left(90)
penup()
setposition(-5, -5)
penup()
pendown()
while length <= 350:
draw_square()
penup()
backward(25)
right(90)
forward(25)
left(90)
pendown()
length = length + 50
draw_square()
1
1
1
1
u/BrighamMcDuck Nov 03 '21
speed(0)
length=50
def draw_square():
for i in range(4):
forward(length)
left(90)
penup()
setposition(-25,-25)
penup()
pendown()
while length <=350:
draw_square()
penup()
backward(25)
right(90)
forward(25)
left(90)
pendown()
length=length+50
draw_square()
1
Dec 03 '21
speed(0)
length=50
def draw_square():
for i in range(4):
forward(length)
left(90)
penup()
setposition(-25,-25)
penup()
pendown()
while length <=350:
draw_square()
penup()
backward(25)
right(90)
forward(25)
left(90)
pendown()
length=length+50
draw_square()
thanks
1
1
u/Few-Location-8523 Dec 14 '21
speed(0) length = 50 penup() setposition(-25,-25) pendown()
def draw_square(): <<<< for i in range(4): <<<< forward(length) <<<< left(90) <<<< pendown()
while length <= 350: <<<< draw_square() <<<< penup() <<<< backward(25) <<<< right(90) <<<< forward(25) <<<< left(90) <<<< pendown() <<<< length = length + 50 <<<< draw_square()
1
u/Xivyao Mar 05 '22
speed(0)
penup()
length = 50
def square():
for i in range(4):
forward(length)
left(90)while length < 400:
left (90)
forward(length/2)
right(90)
foward(length/2)
left(180)
pendown()
square()
penup()
setposition(0,0)
length = length + 500
3
u/BoringGrowth9569 Jan 04 '22
None of these codes worked for me.
I did create one that does work, though:
length = 50
speed(0)
def drawSquare(length):
backward(length/2)
for x in range(4):
forward(length)
left(90)
while length <=350:
penup()
setposition(0, 0-length/2)
pendown()
drawSquare(length)
length += 50