Mastering Python Loops and Functions

Mastering Python Loops and Functions

10th Grade

20 Qs

quiz-placeholder

Similar activities

Python In transit loops and iterations

Python In transit loops and iterations

12th Grade

20 Qs

CO - 2_ Quiz 1_Python Conditionals

CO - 2_ Quiz 1_Python Conditionals

10th Grade - University

15 Qs

Python Next Steps Homework Quiz

Python Next Steps Homework Quiz

8th - 10th Grade

20 Qs

PCEP Section 2B: Perform different types of iterations

PCEP Section 2B: Perform different types of iterations

12th Grade

15 Qs

Python Basics

Python Basics

12th Grade

20 Qs

GirlsWhoML Workshop 0

GirlsWhoML Workshop 0

University

20 Qs

CETA'S Quizzard

CETA'S Quizzard

University

20 Qs

SCRIPTING PROGRAMMING WITH PYTHON

SCRIPTING PROGRAMMING WITH PYTHON

University

15 Qs

Mastering Python Loops and Functions

Mastering Python Loops and Functions

Assessment

Quiz

Computers

10th Grade

Easy

Created by

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?