
LESSON 3: PREDEFINED FUNCTIONS, BOOLEAN & SELECTION STATEMENTS
Presentation
•
Computers
•
7th Grade
•
Hard
Esperanza Sabangan
Used 12+ times
FREE Resource
29 Slides • 21 Questions
1
PYTHON PROGRAMMING: HANDS-ON ACTIVITY 5 & 6
LESSON 3: Predefined Functions, Boolean Expressions and Selection Statements
2
3
4
Poll
Which among these things you did do after you get vaccinated?
5
6
There are TWO rules that must hold in playing the game.
“What’s the logic behind?” 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 45 seconds to answer.
Let's Get it on Pythons!
7
Open Ended
What’s the logic behind?
Your task is to move just one matchstick to fix the equation. This math question seems simple, however, how quickly can you find all 3 solutions?
8
POSSIBLE ANSWERS
1. 5 + 4 = 9
2. 8 - 4 = 4
3. 0 + 4 = 4
9
Open Ended
What’s the logic behind?
Mike, Andrew, Kevin and Rory are playing tug of war. Mike and Andrew pulled Kevin and Rory easily. After that, both Mike and Kevin together managed to pull Rory and Andrew hardly. Then, both Mike and Rory played against Andrew and Kevin but neither of them won the game.
Thus, can you compare them according to their strength?
10
ANSWER: Mike>Andrew>Kevin>Rory
11
Open Ended
What’s the logic behind?
Replace the question mark with a number respecting the equations below. Find the pattern.
12
ANSWER
If we think that each number on the left is the power of 4.
41=4
42=16
43=64
44= 256
13
Open Ended
What’s the logic behind?
Two people played chess 5 times.
Both of them won the same number of games and there was not a single draw. How could this happen?
14
ANSWER
It is only possible if they play with other people.
15
Open Ended
What’s the logic behind?
Please use all the numbers and equation marks only once and do the correct equation.
16
ANSWER
4+5=32
17
Open Ended
What’s the logic behind?
In order to transfer all the balls from the 1st tube to the 3rd tube by keeping them in their original order, how many moves should be done and what are those movements?
(P.S: Name the balls like 1-2-3, and name the tubes I-II-III)
18
ANSWERS
OPTION 1:
Do these moves in these orders:
Transfer the 3rd ball from 1st tube to 2nd tube
Transfer the 2nd ball from 1st tube to to 2nd tube
Transfer the 1st ball from 1st tube to 3rd tube
OPTION 2:
Transfer the 2nd ball from 2nd tube to to 3rd tube
Transfer the 3rd ball from 2nd tube to to 3rd tube
19
Open Ended
What’s the logic behind?
If the dice will be moved until the pointed arrow's end, which number will be on the top?
20
ANSWERS
As a tip, The sum up of the numbers of two reciprocal squares on dice is always 7.
So, the answer is 3.
21
Open Ended
What’s the logic behind?
When you fold this figure and get a cube, what will be the colors of reciprocal squares?
22
ANSWERS
Reciprocal squares will be: Yellow-Red / Blue-Purple / Green-Pink
23
24
Open Ended
How will apply your programming skills in Python's arithmetic operations in daily real life situations?
25
Open Ended
How do you create and assign values to variables?
26
Let's go deeper Pythons! LESSON 4: PREDEFINED FUNCTIONS
27
LEARNING OBJECTIVES
Content:
✓ Explain the purpose of a predefined function
✓ Explain the functions: abs(), pow(), int() round(), random
✓ Explain the math library functions: floor() and ceil()
✓ Explain the use of the import statement
✓ Explain the purpose of a function argument
Process:
✓ Write code that uses predefined functions
28
Let's go deeper Pythons!
Python Activity 5: Predefined Functions Learning Objectives Contents
29
Open Ended
Easy Level Based on your hands-on 3.3 experience and in your own words, how will you define predefined functions in python?
30
A function is a piece of code in a program. The function performs a specific task. The advantages of using functions are:
Reducing duplication of code
Decomposing complex problems into simpler pieces
Improving clarity of the code
Reuse of code
Information hiding
Functions in Python are first-class citizens. It means that functions have equal status with other objects in Python. Functions can be assigned to variables, stored in collections or passed as arguments. This brings additional flexibility to the language.
31
“Modularizing your Code”
32
Python Activity 7: Functions Program Structure
33
Open Ended
Average Level Enter and execute the Python program.
print(abs(-4.67))
print(pow(5,3))
print(pow(49,.5))
print(int(34.8))
print(round(6.9))
import random
print(random.randint(1,100))
a. What is the output for each statement?
b. What is the difference between the round() function and the int() function?
34
35
Open Ended
Difficult Level Enter and execute the Python program.
import math
x = 4.7
y = 5.3
z = -4.8
a = -3.2
print(math.ceil(x)) print(math.ceil(y)) print(math.ceil(z)) print(math.ceil(a)) print(math.floor(x)) print(math.floor(y)) print(math.floor(z)) print(math.floor(a))
a. What is the output for each statement?
b. What is the difference between the ceil() function and the floor() function?
36
37
Open Ended
Easy Level Why and how do we use import statement in python?
38
Identify the function definition, function header and the function call in given program.
39
SAMPLE FUNCTIONS IN MATH MODULE
40
Open Ended
Easy Level What is an argument?
If a function contains more than one argument, do you think the order of the arguments makes a difference? Explain your answer.
41
Let's get it on Pythons!
Python Activity 5: Predefined Functions Learning Objectives Process
42
Open Ended
Easy Level Write a line of code that prints the integer portion of the number 21.45.
43
Open Ended
Easy Level Write code that prompts the user for a floating-point number and prints the smallest integer that is larger than the number the user entered.
44
Open Ended
Easy Level Write a line of code that prints a random number between one and 6.
45
Open Ended
Difficult Level Assume that a user enters any number and that the number is stored in the variable userNumber. Write a line of code that converts the input to a float. Then write a line of code that prints the positive value of the user’s input.
46
Open Ended
Average Level Write a line of code that calculates the square root of 900 and stores the result in the variable answer.
47
48
49
50
Attendance Monitoring & Class Record Python Program
Attendance Monitoring, Class Record and Task Management Program
PYTHON PROGRAMMING: HANDS-ON ACTIVITY 5 & 6
LESSON 3: Predefined Functions, Boolean Expressions and Selection Statements
Show answer
Auto Play
Slide 1 / 50
SLIDE
Similar Resources on Wayground
42 questions
Ancient Greece Review
Presentation
•
7th Grade
46 questions
Black History Month
Presentation
•
7th Grade
41 questions
7.1 Lesson - Introduction to Probability
Presentation
•
7th Grade
41 questions
Rome Geography
Presentation
•
7th Grade
42 questions
INOVASI TEKNOLOGI DALAM BERBAGAI BIDANG
Presentation
•
7th Grade
45 questions
Map Skills
Presentation
•
7th Grade
44 questions
Texas Ecoregions -- Weathering, Erosion and Deposition
Presentation
•
7th Grade
48 questions
Texas Revolution
Presentation
•
7th Grade
Popular Resources on Wayground
5 questions
A Home on the Shore
Quiz
•
3rd Grade
28 questions
US History Regents Review
Quiz
•
11th Grade
6 questions
A Horse Tale
Quiz
•
3rd Grade
20 questions
Math Review
Quiz
•
3rd Grade
10 questions
Juneteenth History and Significance
Interactive video
•
5th - 8th Grade
20 questions
Dividing Fractions
Quiz
•
5th Grade
55 questions
A Long Walk to Water Final Review
Quiz
•
6th - 8th Grade
10 questions
Equation Word Problems
Quiz
•
7th Grade
Discover more resources for Computers
10 questions
Juneteenth History and Significance
Interactive video
•
5th - 8th Grade
55 questions
A Long Walk to Water Final Review
Quiz
•
6th - 8th Grade
10 questions
Equation Word Problems
Quiz
•
7th Grade
15 questions
Soccer World Cup Quiz Questions
Quiz
•
7th Grade
10 questions
Juneteenth: History and Significance
Interactive video
•
7th - 12th Grade
28 questions
A Rover's Story, part 1
Quiz
•
6th - 8th Grade
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...
20 questions
Summer Break Quiz
Quiz
•
7th Grade