Codementum - Test
Codementum - Test
20230608
Let's solve this challenge by using for loops.
turtle.forward(2)
50
Check inside the pots with open() method. You will see
black ones. Try not to touch them!
capsules=[capsule1,capsule2,capsule3]
70
We need to check inside the pots with open() method. Try not
to take black capsules. We should pass black ones by jumping
over them!
Let's solve this challenge by using
if-else conditionals.
91
Use repeat a: loop to execute repetitive codes.
repeat 4:
14
We should use while loop to collect the capsules until they are
depleted.
chests=[chest1,chest2]
while chest.hasItem:
collect()
113
We should learn the not ! logical operation.
lions=[lion1,lion2,lion3]
170
Make sure we use our char parameter inside the collect
function.
def collect(char):
collect(dog)
collect(monkey)
182
By setting a function to onKey event we can control what will
happen when press arrow keys on the keyboard like up, right,
down, and left.
def keyPress(key):
if key == up:
forward(2)
onKey(keyPress)
199
We use ** double star operator to compute power
235
This time there is an error in the code. Let's find and fix it
try:
turtles=[turtle1,turtle1,turtle2]
pots=[pot1,pot2,pot3]
for a in range(3):
turtles[a].forward(3)
pots[a].open()
forward(8)
turn(right)
forward(7)
jump()
except Exception as e:
say(e)
250