CS13 : Everything is relative


One of the most important aspects of computer programming is the ability to make decisions. Making decisions requires the computer to be able to compare things.

We are learning ...
  • About the use of relational operators
So that we can ...
  • Use relational operators ...
    - equal, not equal, less than, greater than, less than or equal to , greater than or equal to
  • Understand what the 'answer' to comparisons 'looks like' and what it means.

Activity 1 Standard relational operators (15)

The standard relational (comparison) operators are ...

https://drive.google.com/file/d/0B83yXMOilskaNXExRVBTcThtWXc/view?usp=drive_web
Click to view

Importantly, notice that the result of ANY comparison operation is either True or False. Period. 

Task 1.1
Notes
Nothing

Make some notes on the different relational operators in your note books.


OUTCOME : Suitable title, followed by handwritten table with list of relational operators, functions and examples.


Activity 2 Your own examples (30)

Relational operators only work with ordinal data types.  You can use string and list modifiers which result in ordinals such as len() in comparison operations.

Task 2.1
 Examples
IDLE Programming Environment


Using each of the above relational operators, construct your own examples to illustrate how they work using the following ordinal data types ...
  • Integer
  • Float
  • Char (single character string in Python)
  • String
OUTCOME : Evidence, probably screenshots, showing your examples using some, if not all, of the relational operators and ordinal types.


Extension Activities 

As we will find out later on, relational operators are commonly used in loops and selection routines to make decisions. There is a script in the resources for this lesson called relationalOperators.py which is basically the bones of a game which you can play (fun!) to help you learn the correct meanings of relational operators. However, because I am lazy, I haven't finished it.

Your challenge is to finish it off, print out the script and give evidence of you scoring 6/6!

What's next?

Before you hand your book in for checking, make sure you have completed all the work required and that your book is tidy and organised. Your book will be checked to make sure it is complete and you will be given a spicy grade for effort.

END OF TOPIC ASSESSMENT