
Python Programming Homework 1
Presentation
•
Computers
•
6th - 9th Grade
•
Medium
Kevin Moore
Used 274+ times
FREE Resource
3 Slides • 13 Questions
1
Python Programming Homework 1
2
What is a variable?
You may have encountered the word 'variable' in Science or Maths.
In programming a variable is a container for storing data (in memory) - the data stored can be changed whilst the program is running.
We can assign values to variables directly or we can get data from user input
3
Multiple Choice
Which of the following is an example of a variable in Python?
print("hello")
age=13
input("Enter your age")
type()
4
Fill in the Blanks
Type answer...
5
Multiple Choice
a = 10
b=5
b=a+5
print(b)
What would be printed to the screen in this example?
5
10
105
15
6
Multiple Choice
a = 10
b=5
b=a+5
print(a)
What would be printed to the screen in this example?
5
10
105
15
7
Multiple Choice
a = 10
b=5
b=a+5
print(a+b)
What would be printed to the screen in this example?
5
10
25
15
8
What is iteration?
In lesson 2 we looked at count-controlled loops (FOR loops). loops are also known as Iteration.
A For loop allows us to repeat an instruction a set number of times.
Remember the Happy Birthday program you wrote in the lesson? You used a for loop to control the output of the song - it also saved you having to repeat lines of code.
9
Multiple Choice
FOR loops are
loops which run an unknown number of times
loops which run for a specific number of times
the same as if statements
not part of programming
10
Multiple Choice
This loop can only be used when the programmer knows the number of times a code is to be repeated
while
for
do while
repeat until
11
Multiple Choice
Which kind of loop would be used?
I need a revision program that will run through revision questions 4 times.
FOR Loop
WHILE Loop
12
Multiple Choice
In programming, what is iteration?
The repetition of steps within a program
The order in which instructions are carried out
A decision point in a program
Testing a program to make sure it works
13
Multiple Choice
Why is iteration important?
It determines the order in which instructions are carried out
It allows code to be simplified by removing duplicated steps
It allows multiple paths through a program
It ensures the code works correctly
14
Multiple Choice
Look at the following code, what will it generate
1,2,3,4,5,6,7,8,9,10,11,12
0,1,2,3,4,5,6,7,8,9,10,11,12
1,2,3,4,5,6,7,8,9,10,11,12,13
0,1,2,3,4,5,6,7,8,9,10,11,12,13
15
Multiple Choice
What does the following program display?
1,2,3,4
1,2,3,4,5
counter,counter,counter,counter,counter
0,1,2,3,4,5
16
Multiple Choice
What does the program display as its output?
1,2,3,4
Python Programming Homework 1
Show answer
Auto Play
Slide 1 / 16
SLIDE
Similar Resources on Wayground
11 questions
Squares & Square Roots
Presentation
•
6th - 9th Grade
11 questions
Calculating Speed
Presentation
•
6th - 9th Grade
12 questions
Proportions Lesson 5.2
Presentation
•
6th - 9th Grade
9 questions
¿Qué estudia la filosofía?
Presentation
•
KG
12 questions
ALGORITMI
Presentation
•
6th - 8th Grade
13 questions
Google Sheets Basics
Presentation
•
6th - 9th Grade
10 questions
Basic Excel Vocabulary
Presentation
•
5th - 8th Grade
11 questions
Volume
Presentation
•
6th - 9th Grade
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade