
Python Random Library Quiz
Quiz
•
Computers
•
9th Grade
•
Practice Problem
•
Hard
Stu Lee
Used 11+ times
FREE Resource
Enhance your content in a minute
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

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
15 questions
Preguntas sobre Excel 2016
Quiz
•
6th Grade - University
12 questions
Computer Basics
Quiz
•
6th - 12th Grade
10 questions
Python with DataScience
Quiz
•
7th Grade - University
10 questions
Tes 1 - Informatika
Quiz
•
9th Grade
10 questions
PC1.8 Evaluate computer program
Quiz
•
9th Grade
13 questions
PERWAKILAN DATA T2 (nombor perlapanan)
Quiz
•
7th - 9th Grade
12 questions
Number Format and Text Orientation in Khmer
Quiz
•
9th Grade
15 questions
Coding Quiz
Quiz
•
6th - 10th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
