replit

Before you start this course, you must login to Replit

If you have forgotten your Replit account user name or password, ask your Coder Coach.

CodeSports

8.2-Investigate

Instructions

Use comments to answer the investigate questions on the example code.

Learning Objectives/Goals

Be able to read, comprehend, trace, adapt and create Python code using selection that:

  • Uses Boolean conditions
  • Uses selection using IF, ELIF and ELSE for more than two situations

Conditions and their definitions

This is a list of definitions:

if condition: Code to run if a certain condition happens.

elif condition: Code to run if condition above is false.

else: Code to run if all conditions have been checked and found false.

Help! My Code Does Not Work!

Make sure that you check for the following things:

  • selection begins with ‘if’ has as many ‘elif’s in the middle as you need and end with ‘else’
  • a colon at the end of each if and else line.
  • each branch is indented unsing the TAB key (not just spaces)
  • if, elif & else aren’t indented
  • a condition after each ‘if’ and ‘elif’
  • no condition after ‘else’
  • a double equals in the condition when chcking that two pieces of data are the same.

replit

Before you start this course, you must login to Replit

If you have forgotten your Replit account user name or password, ask your Coder Coach.

Hints