You are on page 1of 2

Selection with Logical Operators Activity

In the Idle editor, type in the small program (or copy and paste it) from the first column of the
table. When typing these programs, be very careful to type exactly what is shown.

Run the program.

Answer the questions in the second column of the table along with any notes you would like
to include. Then erase the program you typed and type in the next.

There is no need to save these programs but save this completed document and show me!

Program Code Output / Notes

party = input("Are you ready to party? ") How many conditions are there
if party == "yes" or party == "yeah" or party == "alright": for this if structure?
print("Let's party!") There are 3 conditions in this
else: if structure. The “yes”,
print("Well go get ready!"); “yeah” and the “alright”.

How many of them have to be


true to say “Let’s party!”?
All of them have to be true
for the output to be ("Let's
party!").

age = int(input("How old are you? ")); How many conditions are there
license = input("Do you have your license? "); for this if structure?
if age >= 16 and license == "yes": There are 2 conditions under
print("You can drive."); this structure. The age and
else: the license.
print("You can not drive."); How many of them have to be
true to say, “You can drive.”?
Both of these if statements
have to be true for it to let
you drive. For e.g. If age is 18
and no license it won’t let
you drive but if both of them
are true you can drive.

print("Enter -1 to quit."); Run this with several sets of


BP1 = int(input("What's your systolic blood pressure? ")); numbers that are healthy and
BP2 = int(input("What's your diastolic blood pressure? ")); not healthy. Paste your
results here:
while BP1 != -1 and BP2 != -1:
if BP1 <=120 and BP2 <= 80:
print("You are healthy.");
else:
print("See a doctor.");

BP1 = int(input("What's your systolic blood pressure? "));


BP2 = int(input("What's your diastolic blood pressure? "));

You might also like