Activity 7.1
Relational operators
Password checking is an example of a relational operator. If the password entered is the same as the password stored then the condition is true. The operator is ‘is equal to’.
Brainstorm other examples of condition statements and decide what the operator is.
Relation statement
|
Operator
|
Activity 7.2
•
Complete this table of the Python relational operators. Give an example of each and say whether it will evaluate to true or false.
Relational operator
|
Operator
|
Example
|
Evaluates to
|
Equal to
| |||
Not equal to
| |||
Greater than
| |||
Greater than or equal to
| |||
Less than
| |||
Less than or equal to
|
•
Try out your expressions by typing them into the Python interactive shell.
Activity 7.3
Greater than and less than
Find a way that works for you of remembering the difference between “less than” < and “greater than” >.
Hint: As there are only two options you only need to learn one!
Operator
|
>
|
<
|
Operator meaning
|
Greater than
|
Less than
|
How I remember this
|
Activity 7.4
This program asks if it is snowing and if so tells you to take a sledge otherwise to have a good day. The condition is missing.
Copy and complete the condition to make the program work correctly.
Activity 7.5
What condition is needed in this program to display ‘pass’ if the exam mark is 40 or more?
Copy and complete the condition to make the program work correctly.
Activity 7.6
Write a program that asks you to enter the colour of the light at a pedestrian crossing. If the light is green it tells you it is safe to cross, otherwise it tells you to stop.
Activity 7.7
Write a program that asks you for your password. It then asks you to re-enter your password. If they are the same the message “access granted” is displayed. If the passwords are not the same the message “access denied” is displayed.
Lesson 8 activities
This is my HW due for 17/10, sorry it is in three documents :):
ReplyDeletehttps://drive.google.com/a/gillotts.org.uk/?tab=wo#folders/0B6-3dV03iYVgZkhzVU9wWHNfd3M
https://docs.google.com/a/gillotts.org.uk/document/d/1KwggzM7TmSp9eVALIvjlKt1dnIDgT0Dj5aNBUe-8n2U/edit?usp=sharing
ReplyDeleteMy Computing homework due 17/10 - Jamie Legg https://docs.google.com/a/gillotts.org.uk/document/d/11QknbrL3FD3544kb7TWMuSIgfcBPIs3r3GcZ7kCC0Vg/edit?usp=sharing
ReplyDeleteComputing Homework
ReplyDeletehttps://drive.google.com/a/gillotts.org.uk/#folders/0B2wgjrJhAGSyZU1vQ0VvWlN4TkE
my homework for 17th october2014, I posted it on module 9 rather 8 but here it is.
ReplyDeletehttps://www.blogger.com/blogger.g?blogID=2776865912904478211#editor/target=post;postID=3692138635363547050;onPublishedMenu=allposts;onClosedMenu=allposts;postNum=0;src=postname