
Mastering Python Loops and Functions

Quiz
•
Computers
•
10th Grade
•
Easy
JAYA SUDIKSHA
Used 1+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the syntax for a for loop in Python?
for variable in sequence:
for (variable; condition; increment)
for each variable in sequence:
foreach variable in sequence:
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How do you iterate over a list using a for loop?
for each item in my_list:
foreach item in my_list:
for item in my_list:
for item in list my_list:
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What keyword is used to define a function in Python?
def
function
define
method
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the output of the following code: for i in range(5): print(i)?
5
-1
0 1 2 3 4
10
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which of the following is a valid datatype in Python: int, float, string, all of the above?
boolean
dictionary
all of the above
list
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What keyword is used to exit a loop prematurely?
continue
exit
return
break
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How do you define a function that takes parameters in Python?
function_name(parameter1, parameter2) =>
function_name: parameter1, parameter2
function_name(parameter1; parameter2)
def function_name(parameter1, parameter2):
Create a free account and access millions of resources
Similar Resources on Wayground
22 questions
Python Control Structures (Unit 4 AP CSP)

Quiz
•
10th Grade
15 questions
Python Quiz

Quiz
•
12th Grade
20 questions
Lists - Built in Functions

Quiz
•
11th Grade
20 questions
PYTHON PROGRAMMING Q4 FUNCTIONS

Quiz
•
University
20 questions
مراجعة عامة على المنهج – الجزء الأول

Quiz
•
10th Grade
20 questions
Ch.8 - Introducing Python

Quiz
•
6th Grade - Professio...
15 questions
PYTHON QUIZ - DAY 2

Quiz
•
University
20 questions
PYTHON FUNCTION

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade