Preview lessons, content and tests

Computer Science & Programming solved. All in one platform.

1. To trial the platform and take tests, please take a few seconds to SIGN UP and SET UP FREE.
2. Searching for something specific? See our text overview of all tests. Includes 'real teacher' use videos.

Join 30000+ teachers and students using TTIO.

Selection- IF / ELSE Conditional Logic

Selection is a key programming construct which allows the programmer to control the flow of a program. We use conditional logic every day. If X happens, we do Y, else if X does not happen, we may do something else, like Z. Do work through our beginner series on this topic as well.

Example:

a = 7
b = 100
if b > a:
  print("b is greater than a")

In the above example, we use two variables, a and b, which are used as part of the if statement to test whether b is greater than a. As a is 7, and b is 100, we know that 100 is greater than 7, and so we print to screen that "b is greater than a".

Teaching/Learning Presentation with tasks

www.teachyourselfpython.com