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.4-Make

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

Task Instructions

You are going to write a program called “Time Reminder”

  • The user has to enter a number between 0 and 23
  • If the number is less than 8 display a message saying “too early to get up”
  • If the number is less than 12 display a message saying “Good morning”
  • If the number is less than 14 display a message saying “Lunch time!”
  • If the number is less than 18 display a message saying “Good afternoon”
  • If the number is equal to 18 display a message saying “Tea Time”
  • If the number is less than 19 display a message saying “Good evening”
  • If the number is less than 22 display a message saying “Nearly bedtime”
  • If the number is 23 display a message saying “Good night!”
  • Any other number is met with the response “Sorry, I don’t recognise that”

Fully comment your code

Help! My code doesn’t 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.

Hints