Python Random Library Quiz

Python Random Library Quiz

9th Grade

10 Qs

quiz-placeholder

Similar activities

Internet

Internet

7th - 10th Grade

10 Qs

python-BTxâu

python-BTxâu

9th - 12th Grade

10 Qs

AI and Python: Ch.1 Revision

AI and Python: Ch.1 Revision

9th Grade

10 Qs

PERENAMBELASAN

PERENAMBELASAN

9th Grade

10 Qs

Pre-Test Pertemuan 5

Pre-Test Pertemuan 5

1st Grade - University

15 Qs

Podsumowanie: binarny, komputer, sieć

Podsumowanie: binarny, komputer, sieć

7th Grade - University

13 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?