
TERM I 1-2 3-4 Generate pseudo-random numbers and sequences.
Presentation
•
Other
•
12th Grade
•
Hard
Аңсар Әкім
Used 9+ times
FREE Resource
11 Slides • 12 Questions
1
Programming
12 grade
2
1st term | 2nd term | 3rd term | 4th term |
|---|---|---|---|
Unit 12.1А: Python libraries. Generate pseudo-random numbers and sequences. Creating images. Sound processing. | Unit 12.2A: PyGame
Graphic primitives. | Unit 12.3А: PyGame (continuation) Using the game counter. Object collisions. Game development.
| Unit 12.4A: Chatbot development.
Chatbot (Vkontakte) Chatbot (Telegram). |
3
4
Unit 11.2А: Data structures.
Unit 11.3А: Data structures (continuation).
Unit 11.3B: Functions.
Unit 11.4A: Object Oriented Programming (ООP)
5
12.6.1.2 Determine the function of the library Random for the specified task;
12.6.1.3 Identify code snippets that use random sequence generation;
12.6.1.4 Solve problems using random numbers and random sequences.
6
7
8
2. Simulate Coin Toss: Simulate a coin toss using the random function.
3. Randomize List Elements: Shuffle the elements of a list randomly.
4. Random Password Generator: Generate a random password with a given length.
5. Random Sample from List: Select a random sample of elements from a list.
6. Guessing Game Task:
Create a guessing game where the computer generates a random number between a specified range, and the player has to guess the number. The game should provide hints to the player, indicating whether their guess is too high or too low. The player should continue guessing until they correctly guess the number.
9
Multiple Choice
LO: 12.6.1.1 Which library is used to generate pseudo-random numbers in Python?
math
random
rand
pseudo
10
Multiple Choice
LO: 12.6.1.2 If you want to generate a random integer between 5 and 10 (inclusive), which function would you use from the random library?
randint(5, 10)
randrange(5, 11)
choice([5, 6, 7, 8, 9, 10])
uniform(5, 10)
11
Multiple Choice
LO: 12.6.1.1 What function from the random library is used to generate a random floating-point number between 0 and 1?
randrange()
uniform()
random()
choice()
12
Multiple Choice
LO: 12.6.1.2 To shuffle the elements of a list my_list randomly, which function would you use from the random library?
shuffle(my_list)
randomize(my_list)
random.shuffle(my_list)
mix(my_list)
13
Multiple Choice
LO: 12.6.1.3 Which code snippet demonstrates the correct way to generate a random sequence of 5 lowercase letters?
sequence = random.choice('abcdefghijklmnopqrstuvwxyz', 5)
sequence = random.sample('abcdefghijklmnopqrstuvwxyz', 5)
sequence = random.shuffle('abcdefghijklmnopqrstuvwxyz')[:5]
sequence = random.random('abcdefghijklmnopqrstuvwxyz', 5)
14
Learning Objective: 12.6.1.1:
Task 1: Dice Roll Simulation Create a program that simulates rolling a fair 6-sided die 50 times using the random library. Count and display the frequency of each roll outcome (1 to 6).
Learning Objective: 12.6.1.2
Task 2: Random Password Generator Write a program that generates a random password of a given length using the random library's functions. Allow users to choose whether to include uppercase letters, lowercase letters, digits, and special characters.
Task 3: Randomized Selection Design an algorithm to select a random element from a given list using the random library. Implement it and test it with various input lists.
15
Multiple Choice
LO: 12.6.1.3 Which of the following code snippets demonstrates the correct way to select two items from the list my_list randomly?
random.random(my_list, 2)
random.choice(my_list, 2)
random.sample(my_list, 2)
random.shuffle(my_list)[:2]
16
Multiple Choice
LO: 12.6.1.1 Which of the following statements is true about pseudo-random numbers?
Pseudo-random numbers are truly random and unpredictable.
Pseudo-random numbers are generated using physical randomness sources.
Pseudo-random numbers are generated using deterministic algorithms.
Pseudo-random numbers are generated using a hardware random number generator.
17
Multiple Choice
LO: 12.6.1.2 You want to generate a random boolean value (True or False). Which function would you use from the random library?
random.choice([True, False])
random.boolean()
random.random_bool()
random.randint(0, 1)
18
Learning Objective: 12.6.1.3:
Task 4: Random Word Generator Develop a program that generates a random word by selecting characters randomly from a given set. Print the generated word.
Task 5: Shuffled Sentence Write a program that takes a sentence as input and randomly shuffles the order of words using the random library. Display the shuffled sentence.
Task 6: Randomized Quiz Questions Create a quiz application that displays multiple-choice questions with randomized answer options. Use the random library to shuffle the answer choices.
Learning Objective: 12.6.1.4:
Task 7: Casino Game Simulation Develop a simulation of a imple casino game (e.g., rolling dice for points) using the random library. Keep track of player scores over multiple rounds.
19
Multiple Choice
LO: 12.6.1.3 Which code snippet demonstrates the correct way to randomly shuffle the characters in a string my_string?
random.shuffle(my_string)
shuffled_string = ''.join(random.sample(my_string, len(my_string)))
shuffled_string = my_string.random_shuffle()
shuffled_string = random.shuffle_str(my_string)
20
Multiple Choice
LO: 12.6.1.2 What is the purpose of the random.seed() function in the random library?
To generate truly random numbers.
To set the range for random numbers.
To initialize the pseudo-random number generator's internal state.
To generate cryptographically secure random numbers.
21
Multiple Choice
LO: 12.6.1.3 You want to generate a list of five random integers between 1 and 100. Which code snippet accomplishes this?
random.integers(1, 100, 5)
random.randint(1, 100, 5)
[random.randint(1, 100) for _ in range(5)]
random.sequence(1, 100, 5)
22
1 . Random Walk Simulation: Simulate a 2D random walk starting from a central point. Generate a series of random steps (up, down, left, right) and visualize the path.
2. Randomized Permutation Generation: Generate a random permutation of numbers from 1 to N.
3. Randomized String Generation: Generate a random string of a certain length using a given set of characters.
4. Randomized Game Strategies: Develop a simple two-player game (like Rock-Paper-Scissors) where each player uses a randomized strategy.
5. Randomized Binary Search: Implement a randomized version of the Binary Search algorithm to find an element in a sorted array.
23
Poll
Thank you for completing this learning module on generating pseudo-random numbers and sequences using the random library. Your feedback is important to us. On a scale of 1 to 5, how would you rate your understanding of the topic after completing this module?
1: Very Limited Understanding
2: Limited Understanding
3: Moderate Understanding
4: Good Understanding
5: Very Good Understanding
Programming
12 grade
Show answer
Auto Play
Slide 1 / 23
SLIDE
Similar Resources on Wayground
19 questions
Module 1 Lesson 3A: Storage Devices
Presentation
•
12th Grade
20 questions
4.2 Basic Probability Rules
Presentation
•
12th Grade
18 questions
L3 YR1 Unit 306 session 7 Customer information
Presentation
•
12th Grade
19 questions
L3 YR1 Unit 306 session 4 Regulations and manufacturers ins
Presentation
•
12th Grade
19 questions
L3 YR1 Unit 306 session 8 Risk assessment
Presentation
•
12th Grade
15 questions
Job Interview
Presentation
•
12th Grade
18 questions
Ejercicios de Sucesiones Lineales
Presentation
•
12th Grade
20 questions
Buku Fiksi Non Fiksi
Presentation
•
12th Grade
Popular Resources on Wayground
10 questions
Safety Day 2026 – Student Review
Quiz
•
9th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
12 questions
Map Skills
Quiz
•
3rd Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
15 questions
Rounding Decimals
Quiz
•
5th Grade
Discover more resources for Other
26 questions
SLIME!!!!!
Quiz
•
KG - 12th Grade
21 questions
Los paises hispanohablantes y sus capitales
Quiz
•
12th Grade
20 questions
Cell Transport
Quiz
•
9th - 12th Grade
20 questions
Budgeting
Quiz
•
9th - 12th Grade
20 questions
Investing
Quiz
•
9th - 12th Grade
8 questions
DNA vs. RNA
Presentation
•
9th - 12th Grade
12 questions
Identify Rigid Transformations
Quiz
•
8th - 12th Grade
10 questions
Complementary, Supplementary, Vertical, and Linear Pairs
Quiz
•
9th - 12th Grade