
Python Random Library Quiz

Quiz
•
Computers
•
9th Grade
•
Hard
Stu Lee
Used 3+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Python Pre-defined Functions

Quiz
•
9th Grade
15 questions
coding

Quiz
•
KG - Professional Dev...
10 questions
Delphi Arguments/Returns

Quiz
•
8th - 10th Grade
15 questions
1.1 System Architecture - Keywords

Quiz
•
9th - 12th Grade
10 questions
Python Input/Output

Quiz
•
9th - 12th Grade
6 questions
модули python

Quiz
•
9th - 12th Grade
13 questions
Entry Level - Programming Techniques

Quiz
•
8th - 9th Grade
10 questions
Quiz Tipe Data

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

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

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
20 questions
Analog vs Digital

Quiz
•
9th - 12th Grade
10 questions
Exploring Cybersecurity Techniques and Threats

Interactive video
•
6th - 10th Grade
10 questions
Understanding the Internet and Data Transmission

Interactive video
•
7th - 12th Grade