
Mastering Python Loops and Functions
Authored by JAYA SUDIKSHA
Computers
10th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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):
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
16 questions
Gerência do Processador
Quiz
•
University
22 questions
Text and Image representation
Quiz
•
11th Grade
15 questions
IT 209
Quiz
•
University
20 questions
PHP First Internal Practical Viva
Quiz
•
University
20 questions
Informática 1
Quiz
•
10th Grade
20 questions
quizz tkinter
Quiz
•
11th Grade - University
15 questions
Algoritma dan Pemrograman Bab 1
Quiz
•
University
Popular Resources on Wayground
8 questions
2 Step Word Problems
Quiz
•
KG - University
20 questions
Comparing Fractions
Quiz
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Latin Bases claus(clois,clos, clud, clus) and ped
Quiz
•
6th - 8th Grade
22 questions
fractions
Quiz
•
3rd Grade
7 questions
The Story of Books
Quiz
•
6th - 8th Grade