
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
20 questions
PYTHON REVISION

Quiz
•
University
20 questions
GCSE Computer Science: Programming (Data Structures)

Quiz
•
9th - 10th Grade
21 questions
Python Concepts Quiz

Quiz
•
11th Grade
15 questions
CSE 102 Exam 2 Practice

Quiz
•
University
20 questions
PYTHON PROGRAMMING Q5 ITERATIONS

Quiz
•
University
15 questions
PSP Week 4

Quiz
•
University
25 questions
Python

Quiz
•
11th Grade
25 questions
Algorithms - python (GCSE)

Quiz
•
10th - 12th Grade
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
10 questions
Afterschool Activities & Sports

Quiz
•
6th - 8th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
15 questions
Cool Tool:Chromebook

Quiz
•
6th - 8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
20 questions
Bullying

Quiz
•
7th Grade
18 questions
7SS - 30a - Budgeting

Quiz
•
6th - 8th Grade