Tuesday, July 29, 2014

Repeat Loops for Drawing Squares with Pro-Bot

Let’s write down the code for drawing a square with sides 6 cm each, using Pro-Bot. 





















Do you see a repeating pattern in the code?

Circle the part in the code that repeats. Circle the corresponding part in the picture as well.

Write down the part of the code that repeats.




How many times do we repeat the pattern?


Can you now rewrite the code for the above square using a Repeat loop?

Rpt  _________   [                                 




]



How many lines of code were there in your first version, without the Repeat Loop?


How many lines of code are there in your new version using the Repeat Loop?


By how much did you reduce the number of lines of code in your new version?


Can you now write a program for Pro-Bot to draw a square of sides 10 cm using a Repeat Loop?


Rpt  _________   [                                 




]



Part of a Square

The following figure looks like a square with one side of it removed. Each side measures 6 cm. Can you write a program for Pro-Bot to draw it using a Repeat Loop? 
















No comments:

Post a Comment