Learn to program

 
  Finch assignments ::

Learning Goal: Understand how to write a program to control a robot, using loops, conditionals and subroutines where appropriate.

 

 
 

Finch Assignment 11 - Conditional Statements (If-Then)

Learning goal: understand the use of conditional statements in a program.

You need to know how to branch in a program, so you can have different results depending on different inputs.

For example, you could program the robot to do different actions when it is light, compared to when it is dark.

conditional

 

Watch these videos to find out about If-Then (conditional) statements.

This one is a little long, but is a great review, and uses Python 2.

Everyone should watch these:

Python If

Python If-Else

Python If - Elif - Else

 

Assignment 11

Write a program to ask the user what color they prefer. Give a choice of three colors.

Have the robot do a different action based on each of the three colors.

If you want to have a set of possible options you can use the if...in statement. This is called a List.

if_in

To turn it in, look at the instructions below:

  • Go to Google Drive
  • Open the Class Program folder in 'Shared with me'
  • Open your class folder and assignment folder
  • Click on the "New" button on the top left
  • Upload the program from your computer


Write a Reflection on what you have learned.