generated from mwc/lab_iteration
Hello! So yes, it was a little difficult, but not impossible. I think CS is mostly about logic and mathematics (or that's how i feel right now). I knew it would need a list within the definition but I thought putting a '4' as a motion would be the solution to do the motion 4x. Except it didn't. So then I reread the lab instructions and I guessed it would need 4 '1's to get completed. And that worked! So not actually that difficult to figure out but you need to use your brain. I'm just thinking it doesn't feel super intuitive to me yet, but I'm sure this will come with more practice! We just started haha.
16 lines
227 B
Python
16 lines
227 B
Python
from turtle import *
|
|
|
|
def square(side_length):
|
|
|
|
motions = [1,1,1,1]
|
|
for motion in motions:
|
|
forward(side_length)
|
|
right(90)
|
|
|
|
|
|
sizes = [20, 40, 60, 80, 100]
|
|
for size in sizes:
|
|
square(size)
|
|
input()
|
|
|