Open project · after lesson 5: Stars that move themselves
Fill an aquarium with fish that swim by themselves. Each fish is an object made from a class you write, with its own colour and speed and a method that moves it.

These light up when your code uses them. Click one to see where you learned it.
Tick each one when it is true of your project. Nobody marks it: be honest with yourself.
class Fish:
def __init__(self, colour, y):
self.turtle = Turtle()
self.turtle.shape("circle")
self.turtle.color(colour)
self.turtle.penup()
self.turtle.goto(random.randint(-200, 200), y)
self.speed = random.randint(2, 6)def swim(self):
self.turtle.forward(self.speed)
if self.turtle.xcor() > 230 or self.turtle.xcor() < -230:
self.turtle.left(180)def tick():
for f in tank:
f.swim()
ontimer(tick, 50)Tick every milestone first.
You built it with: