I Haz Codes

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Menu
Using ==

Learn

When starting to learn about if statements it is important to get to grips with the basic syntax and terminology. Also, you need to understand the difference between = and ==. In python a single = is used to assign values to a variables while == is used to check if two things are the same or not.

Try

  1. Run the code below and test it with the values “platinum” and “gold”.
  2. Display the variable “points” using a print command.
  3. Enter two more if statements for silver and bronze. Silver should have 2 points and bronze have 1.

Challenge

Write a program which will display a single digit in words. For example, if the user enters “1” then the program will display “one”. See the end of the video for more details.

Test

Try the following quiz to test your knowledge.

tasks to try

Comments are closed.

Information