

Python Lesson Discussion 2-26-2025
Presentation
•
Computers
•
12th Grade
•
Easy
Steve Howard
Used 2+ times
FREE Resource
32 Slides • 22 Questions
1
2
3
4
Dropdown
5
6
Dropdown
7
8
9
Dropdown
10
Multiple Choice
What will this code print?
<class 'str'>
str
greeting
Hello world
11
12
Multiple Choice
What will this print?
<class 'int'>
int
50
my_number
13
Explanation Slide...
You can use the type function to determine a variable's type.It gives you a little more than you need to know, but you can find the type in single quotes after the word class.
14
15
Match
Match definitions with statements
variable = value
type(element)
print(“text”)
Assigns a value to a variable name
Determines the type of an element
Prints entered text
Assigns a value to a variable name
Determines the type of an element
Prints entered text
16
Multiple Choice
What type is the following variable?
x = "Hi there"
float
integer
boolean
string
17
Multiple Choice
What does the following Python program print?
I am 6 feet tall
I am6feet tall
I am
6
feet tall
x
y
z
18
19
20
Labelling
Label the statement
function to receive input from user
variable name
The prompt
21
Explanation Slide...
22
Dropdown
23
24
Multiple Choice
What will this statement print?
Age: 22
22
<class 'str'>
Age:
22
text
25
26
Multiple Choice
How to correct this?
number = int(input("Number: "))
print(number + 1)
number = print(number + 1)
print(number + 1)
27
28
29
30
Multiple Choice
On which line will this program call an error in the console?
1
2
3
4
31
Explanation Slide...
Line 2 will product the error. You cannot divide a str by an integer. You need to convert the user's input to an int.
32
33
Multiple Choice
Suppose you run the following Python program:
x = input("Enter some text: ") print(x)
While the program is running, after the prompt has been printed, the user types the following and presses Enter:
Delaware ratified the U.S. Constitution in 1787.
What does the program print?
Delaware ratified the U.S. Constitution in 1787.
Delaware ratified the U.S. Constitution in
Delaware
(The program does not print anything.)
34
35
36
Multiple Choice
What does the following Python program print?
x = 12 % 4
print(x)
0
1
3
4
37
Explanation Slide...
The modulus operator gives the remainder when dividing two values. Because 4 divides 12 evenly, there is no remainder, so 12 % 4 gives a value of 0.
38
Multiple Choice
What does the following Python program print?
x = 9 + 6 / 3 * 2 - 1
print(x)
9
15
21
12
39
Explanation Slide...
Python follows the order of operations so it divides 6/3 first (which equals 2), then multiplies 2*2 (which is 4), then adds 9 + 4 (which is 13) and then subtracts 1 (which is 12).
40
41
42
Dropdown
43
44
Multiple Choice
How do you correct this?
print("a" + str(3))
print("a" + 3))
str(3))
45
Explanation Slide...
You can convert the integer into a string using the str function before adding it to a string.
46
47
Multiple Choice
Which of the following Python programs will not run?
48
Explanation Slide...
Python cannot concatenate variables of different types!
49
Multiple Choice
Which of the following is NOT a program that will produce the following output?
hellohellohello
50
Explanation Slide...
This code will print ‘hello’ each on a separate line
51
52
Multiple Choice
Which of the following is NOT a valid type of comment in Python?
%% This is a comment
# This is a comment
" " "
This is a comment
" " "
53
Explanation Slide...
Great work! We can only use “”” for multiline comments and # for in-line comments.
54
Multiple Choice
Which of the following best describes the main purpose of comments?
Comments create better spacing in programs.
Comments describe your program so other people can read it more easily.
Comments warn the people running the program about potential problems with the program.
Show answer
Auto Play
Slide 1 / 54
SLIDE
Similar Resources on Wayground
52 questions
Endogenic Processes I
Presentation
•
11th Grade
51 questions
EmTechWk2Lesson1.2
Presentation
•
11th - 12th Grade
49 questions
Indonesia Masa Orde Baru (1966-1998)
Presentation
•
12th Grade
46 questions
GDPR en wetgeving
Presentation
•
KG
53 questions
Recap: Unit 1 Information Technology Systems - Summer Term
Presentation
•
12th Grade
46 questions
Costs & Benefits of Globalization
Presentation
•
12th Grade
48 questions
DCS1101 - Week 9 (Arrays)
Presentation
•
University
47 questions
Archetypes Intro
Presentation
•
12th Grade
Popular Resources on Wayground
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
10 questions
MyPath Diagnostic Overview
Presentation
•
6th - 8th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Adding and Subtracting Decimals
Quiz
•
5th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
21 questions
Lab Safety
Quiz
•
10th Grade