
LESSON 3: BOOLEAN EXPRESSIONS & SELECTION STATEMENTS
Presentation
•
Computers
•
7th Grade
•
Practice Problem
•
Easy
Esperanza Sabangan
Used 7+ times
FREE Resource
33 Slides • 32 Questions
1
PYTHON PROGRAMMING: HANDS-ON ACTIVITY 5 & 6
LESSON 3: Predefined Functions, Boolean Expressions and Selection Statements
2
3
4
Open Ended
What’s the funniest excuse you’ve ever used to get out of deadlines/for NOT complying with school requirements?
5
6
There are TWO rules that must hold in playing the game.
“What’s the condition behind the logic?” is a VISUAL BRAIN TEASER LOGICAL PUZZLE GAME. The game will enhance your critical thinking ability.
ALL OF YOU will be the participants and must answer by analyzing the pictures or illustrations to be shown.
You will be given a duration of 60 seconds to answer.
Let's Get it on Pythons!
7
Open Ended
What’s the condition behind the logic?
Frank's father has 5 sons. If the names of his 4 sons are Fefe, Fifi, Fofo, Fufu, respectively, then what would be the name of his 5th son?
8
ANSWER
If, Frank's father has 5 sons and the names of 4 sons are like above.
Then, Frank is the 5th son already.
9
Open Ended
What’s the condition behind the logic?
Which one is the right view for the person who stays at the orange point and looks at the figure from the pointed direction?
10
ANSWER
If, there are obviously 4 blocks at the bottom. And the second layer above the bottom, there are 2 blocks on the right. So the answer is definitely not C.
Then, on the top layer, there is only one block that is seen.
So, the answer is D
11
Open Ended
What’s the condition behind the logic?
How many triangles are there in the image?
12
ANSWER
If,
The number of triangles forms of 1 unit: 16
The number of triangles forms of 4 units: 7
The number of triangles forms of 9 units: 3
The number of triangles forms of 19 units: 1
Then, the total number of triangles is 27.
13
Open Ended
What’s the condition behind the logic?
How can you get 30 by placing the balls into the boxes in the following equation?
14
ANSWER
This question cannot be solved mathematically. Because the sum of three odd numbers cannot be even. But here the important thing is your attention
If, you place the balls numbered with 11 and 13, you will get 24.
Then, if you place the ball numbered with 9 but inverted, you will get 24+6=30.
15
Open Ended
What’s the condition behind the logic?
How many squares are there on a chessboard?
16
ANSWER
If, we order them according to their sizes:
Then,
8x8 : 1
7x7 : 4
6x6 : 9
5x5 : 16
4x4 : 25
3x3 : 36
2x2 : 49
1x1 : 64
So on a chessboard, there are 204 square.
17
Open Ended
What’s the condition behind the logic?
Find the weights of animals below.
18
ANSWER
If, two bears weigh 120 kg, then one bear is 60 kg
Then, One bear and one rabbit weigh 70 kg and a bear is 60 kg, then a rabbit is 10 kg.
Else, One bear and one rabbit weigh 70 kg, and then a fox is 20 kg.
19
Open Ended
What’s the condition behind the logic?
How many squares are there in the image?
20
ANSWER
If,
The number of 1 unit squares: 6
The number of 2 units squares: 6
The number of 3 units squares: 3
The number of 4 units squares: 2
Then, the total number of squares is 17.
21
Open Ended
What’s the condition behind the logic?
What shape should be in the top brick?
22
ANSWER
An octagon. Each shape has the same number of sides as the sum of the sides of the two shapes below it.
If, the number is over 10, then the last digit is used instead. For example, 9 + 8 = 17 so the brick above is 7-sided.
Then, the top shape is an 8-sided octagon because there are two 4-sided shapes below it.
23
Open Ended
What’s the condition behind the logic?
Which of the four domino figures completes the set?
24
ANSWER
If, Each line contains two red dice and one blue die.
Each line contains a two, a three and a five.
Then, the missing image is of a red die, number three.
25
Open Ended
What’s the condition behind the logic?
Which one is the top view of the tower on the left?
26
ANSWER
If, you look at to the tower from the above, the top layer is orange. So, the answer is definitely not C.
Then, the second purple layer will not be seen from the above because it is the same size with the top layer.
And the third layer won't be seen either because it is smaller size then the top two layers.
The fourth layer will be the next one that's going to be seen from the above around the purple layer.
The last one is going to be the largest and it is orange. According to these, the answer is going to be A
27
Open Ended
What’s the condition behind the logic?
Which one is the correct shadow of the animal on the picture?
28
ANSWER
If, there is a rooster on the big picture.
Then, A is a shadow of a seagull, B is a chicken, C is a duck, and D is a rooster.
So, the answer is D.
29
Open Ended
What’s the condition behind the logic?
A person sees this picture on the left from where he/she stands. So, which image is he/she looking at to see that picture?
30
ANSWER
If, you look at the image A on the right side,
Then, you will see the image in the big picture.
31
32
Open Ended
How can YOU use the built-in code (predefined functions) that is already part of Python?
33
Multiple Choice
Which one is NOT true about function?
It breaks the large program into small modules.
It avoids repetition.
It makes code reusable.
It makes the program unorganized.
34
Multiple Choice
Consider the line of code:
drawFramedLabel("Go Team!", 200, 100, "gold")
The code highlighted in blue is best defined as:
function name
function call
function definition
arguments
parameters
35
Multiple Choice
When defining a function, the definition must occur before it is called.
true
false
36
Multiple Choice
What is a piece of code that can take inputs to perform a certain task?
a function
arguments
parameters
37
Multiple Choice
Which of the following keywords marks the begining of the function block?
Func
define
def
function
38
Multiple Choice
What does the statement
import math do?
This is needed to use the functions in the math module. The math module includes int() and float().
This is needed to use the functions in the math module. The math module includes round(), pow() and abs().
This is needed to use the functions in the math module. The math module includes floor() and ceil().
This is needed to do PEMDAS (order of operations) correctly.
39
Multiple Choice
import math
x=math.ceil(-4.67)
What is the value of x?
-4
-5
-4.67
4.67
40
Multiple Choice
import math
x=math.floor(-4.67)
What is the value of x?
-4
-5
-4.67
4.67
41
Q3 - LESSON 5: PYTHON ACTIVITY 6 - BOOLEAN EXPRESSIONS AND SELECTION STATEMENTS
42
LEARNING OBJECTIVES
Content:
✓ Explain the three types of programming structures
✓ Explain how conditional operators and logical operators are used in programming
✓ Use conditional operators with strings and numeric values
✓ Implement the Python syntax of an if/else statement
✓ Determine good test data for programs that include if/else statements
Process:
✓ Write code that includes if statements and if/else statements
✓ Write correct Boolean expressions and compound expressions
43
Let's get it on Pythons!
Python Activity 6: Boolean Expressions & Selection Statements
44
PYTHON PROGRAMMING SKILLS ASSESSMENT
DIRECTIONS: "Let's get it on Pythons!" is a skills assessment designed to measure your proficiency in python programming.
Open PYTHON and go new file to open the compiler.
This is a time bound type of assessment. The time duration for each item depends on the complexity of the problem.
Let's Get it on Pythons!
45
Open Ended
Write a Boolean expression that tests if the value stored in the variable num1 is equal to the value stored in the variable num2.
46
47
Open Ended
Write a Boolean expression that tests if the value stored in the variable time is less than the value stored in the variable maxTime or if the value stored in the variable cost is less than the value stored in the variable maxCost
48
49
Open Ended
Write the code for an if statement that adds 5 to the variable num1 if the value stored in the variable testA equals 25. Otherwise subtract 5 from num1.
50
51
Open Ended
Write the code for an if statement that prints a random number between one and 6 if the value stored in the variable isValid equals the Boolean value true.
52
53
Open Ended
Write a Python program that prompts the user for the cost of two items to be purchased. Then prompt the user for their payment. If they enter an amount that is less than the total cost of the two items, print a message that tells them how much they still owe. Otherwise, print a message that thanks them for their payment and tells them how much change they will receive. Thoroughly test your code for all possible input.
54
55
Open Ended
Write a Python program that prompts the user for a word. If the word comes between the word’s apple and pear alphabetically, print a message that tells the user that the word is valid, otherwise, tell the user the word is out or range.
56
57
Open Ended
Write a Python program that prompts the user for a multiple of 5 between 1 and 100. Print a message telling the user whether the number they entered is valid.
58
59
Let's go deeper Pythons!
Python Activity 6: Boolean Expressions & Selection Statements
60
Open Ended
Which structure best describes the types of Python programs you have written so far? Do you think this structure is the best structure to use for all programs? Why or why not?
61
Open Ended
What is the result of each of the following expressions?
Assume x = 4, y = 5, z = 4
What is the result of the following expressions?
Assume word1 = “hello”, word2 = “good-bye”
62
Open Ended
In terms of usage, what are the differences between conditional operators and logical operators?
63
64
Attendance Monitoring Program, Class Record Program & Library System
65
PYTHON PROGRAMMING: HANDS-ON ACTIVITY 5 & 6
LESSON 3: Predefined Functions, Boolean Expressions and Selection Statements
Show answer
Auto Play
Slide 1 / 65
SLIDE
Similar Resources on Wayground
60 questions
Proportional Reasoning
Presentation
•
7th Grade
59 questions
Expanding Double Brackets
Presentation
•
7th Grade
59 questions
Module 5 Exam Practice (Algebraic Expressions)
Presentation
•
7th Grade
63 questions
Geography Handbook
Presentation
•
7th Grade
63 questions
Grade 7 EOY Review
Presentation
•
7th Grade
60 questions
AP Biology Organelles
Presentation
•
7th Grade
60 questions
Ratio Reasoning
Presentation
•
7th Grade
56 questions
Characteristics of the Election Process
Presentation
•
7th Grade
Popular Resources on Wayground
20 questions
STAAR Review Quiz #3
Quiz
•
8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
6 questions
Marshmallow Farm Quiz
Quiz
•
2nd - 5th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade
12 questions
What makes Nebraska's government unique?
Quiz
•
4th - 5th Grade
Discover more resources for Computers
20 questions
Revising & Editing practice
Quiz
•
7th Grade
10 questions
Box Plots
Quiz
•
6th - 7th Grade
14 questions
Volume of rectangular prisms
Quiz
•
7th Grade
22 questions
Simple Probability
Quiz
•
7th Grade
20 questions
Graphing Inequalities on a Number Line
Quiz
•
6th - 9th Grade
20 questions
genetics vocabulary
Quiz
•
7th Grade
4 questions
Spring Break rest and recharge
Presentation
•
6th - 8th Grade
24 questions
7th grade STAAR Reading Review
Quiz
•
7th Grade