# Program

## Lesson 2 – Turning the Finch

#### Required Python Concepts

Arithmetic calculations

#### Teaching Materials

The wheels() method that you used to move the Finch forward and back is also used to make the Finch turn. To make the Finch move in a straight line, you kept the left and right wheels speeds the same. If the speed of the left wheel is different from the speed of the right wheel, the robot will turn.

#### Exercise 1:

Create a new file named “FinchTurn.py” and try out the commands shown above. It should make the Finch turn right for 3 seconds.

#### Exercise 2:

Try changing the time that the Finch should move. How long should the Finch move to turn 90°?

#### Exercise 3:

Write a program that makes the Finch move in a square. Hint: The Finch turns more accurately at low speeds.

#### Exercise 4:

When the wheels have the same speed but different directions (one speed is positive and the other is negative), the Finch turns in place. You can get different turns with other speed combinations. Try out the command below. How is this turn different?

#### Exercise 5:

Write a program that asks the user for the speeds of the right and left wheels and then moves the Finch for 2 seconds with those speeds. What happens when the right and left speeds are close together? What happens when they are far apart?

#### Exercise 6:

Write a program that asks the user for a wheel speed between 0 and 1. The robot should turn for 5 seconds with the speed of the left wheel equal to the speed entered by the user and the speed of the right wheel equal to half the entered speed. How does the radius of the turn depend on the speed entered by the user?

#### Exercise 7:

Write a program that asks the user for a number of seconds. The robot should turn right for number of seconds entered by the user, then move forward for twice that number of seconds, and then turn left for half of that number of seconds.