Python Random Library Quiz

Python Random Library Quiz

9th Grade

10 Qs

quiz-placeholder

Similar activities

Herramientas WEB

Herramientas WEB

6th Grade - Professional Development

11 Qs

visual basic 6.0 LDA

visual basic 6.0 LDA

9th Grade

15 Qs

LA5.C5: Branching and Subroutines

LA5.C5: Branching and Subroutines

9th Grade - University

14 Qs

REVIEW AD KLS 9

REVIEW AD KLS 9

9th Grade - University

10 Qs

Explorando Tinkercad en Secundaria

Explorando Tinkercad en Secundaria

7th Grade - University

10 Qs

2025 python class first quiz

2025 python class first quiz

9th Grade - University

10 Qs

Python List

Python List

4th Grade - University

15 Qs

Python

Python

8th - 9th Grade

15 Qs

Python Random Library Quiz

Python Random Library Quiz

Assessment

Quiz

Computers

9th Grade

Practice Problem

Hard

Created by

Stu Lee

Used 11+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which function from the Python `random` library generates a random integer between two specified numbers?

random.uniform()

random.randint()

random.random()

random.choice()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does `random.uniform(1, 10)` do in Python?

Generates a random integer between 1 and 10

Generates a random float between 1 and 10

Generates a random integer between 0 and 1

Generates a random float between 0 and 1

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following imports the Python `random` module correctly?

import rand

import random_number

import random

import numbers

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you generate a random choice from a list in Python?

random.choice()

random.list()

random.pick()

random.select()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of `random.randint(1, 1)`?

Error

0

1

None

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following will generate a random float between 0 and 1?

random.randint(0, 1)

random.random()

random.choice([0, 1])

random.uniform(0, 1)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does `random.choice(['apple', 'banana', 'cherry'])` return?

A random float

A random integer

A random string from the list

An error

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?