import random, turtle def rwalk(t, d, n): for i in range(n): r = random.randint(0,7) a = 45*r t.seth(a) t.forward(d) return def rwalk2(t1, t2, d, n): for i in range(n): r1 = random.randint(0,7) a1 = 45*r1 r2 = random.randint(0,7) a2 = 45*r2 t1.seth(a1) t1.forward(d) t2.seth(a2) t2.forward(d) return #------------ bob = turtle.Turtle() alice = turtle.Turtle() bob.up() bob.goto(-100,100) bob.down() alice.up() alice.goto(100,-100) alice.down() rwalk2(alice, bob, 20, 100)