diff --git a/src/m1e_comments_strings_print.py b/src/m1e_comments_strings_print.py index 18eb8a0..1f0f748 100644 --- a/src/m1e_comments_strings_print.py +++ b/src/m1e_comments_strings_print.py @@ -14,3 +14,6 @@ print('one', 'two', 'buckle my shoe') print(3 + 9) print('3 + 9', 'versus', 3 + 9) +print('3/2') +print(3/2) + diff --git a/src/m3_turtles.py b/src/m3_turtles.py index df507f3..083a223 100644 --- a/src/m3_turtles.py +++ b/src/m3_turtles.py @@ -2,7 +2,7 @@ Demonstrates using OBJECTS via Turtle Graphics. Concepts include: - -- CONSTRUCT an INSTANCE of a CLASS (we call such instances OBJECTS). + -- CSSE 120 (we call such instances OBJECTS). -- Make an object ** DO ** something by using a METHOD. -- Reference an object's ** DATA ** by using an INSTANCE VARIABLE. @@ -62,17 +62,25 @@ # ---------------------------------------------------------------------- dave.forward(100) dave.left(90) -dave.forward(200) +dave.forward(100) +dave.left(90) +dave.forward(100) +dave.left(90) +dave.forward(100) # ---------------------------------------------------------------------- # Construct a new turtle and ask it to do things. # ---------------------------------------------------------------------- matt = rg.SimpleTurtle('turtle') -matt.pen = rg.Pen('red', 30) -matt.speed = 10 # Faster -matt.backward(50) +matt.pen = rg.Pen('green', 15) +matt.speed = 14 # Faster +matt.backward(200) matt.left(90) -matt.forward(50) +matt.forward(200) +matt.right(90) +matt.forward(200) +matt.right(90) +matt.forward(200) ######################################################################## diff --git a/src/m5_your_turtles.py b/src/m5_your_turtles.py index d9de2a6..0bfab5d 100644 --- a/src/m5_your_turtles.py +++ b/src/m5_your_turtles.py @@ -2,7 +2,7 @@ Your chance to explore Loops and Turtles! Authors: David Mutchler, Dave Fisher, Valerie Galluzzi, Amanda Stouder, - their colleagues and PUT_YOUR_NAME_HERE. + their colleagues and Xuechen Bai. """ ######################################################################## # TODO: 1. @@ -27,4 +27,31 @@ # fixing them at either this session OR at the NEXT session. # # Don't forget to COMMIT your work by using VCS ~ Commit and Push. -######################################################################## +############################################################################ + +import rosegraphics as rg +window = rg.TurtleWindow() +lanxi = rg.SimpleTurtle('turtle') +lanxi.pen = rg.Pen('pink', 3) +lanxi.speed = 10 +for k in range(20): + lanxi.draw_circle(radius=100-5*k) + lanxi.pen_up() + lanxi.right(90) + lanxi.backward(10) + lanxi.left(90) + lanxi.pen_down() + +james = rg.SimpleTurtle('turtle') +james.pen = rg.Pen('light blue', 3) +james.speed = 10 +for k in range(20): + james.draw_circle(radius=100-5*k) + james.pen_up() + james.right(90) + james.forward(10) + james.left(90) + james.pen_down() + +window.close_on_mouse_click() +