
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
Welcome!
Programming
12 grade
2
Programming, Grade 12
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
What do we already know?
4
Unit 11.1А: Basic structures of the Python programming language
Unit 11.2А: Data structures.
Unit 11.3А: Data structures (continuation).
Unit 11.3B: Functions.
Unit 11.4A: Object Oriented Programming (ООP)
Programming 11 grade
5
12.6.1.1 uses the functions of the library Random to get a pseudo-random number;
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.
Generate pseudo-random numbers and sequences.
6
7
8
Let's solve tasks!
1. Generate Random Numbers: Generate a sequence of random numbers between a given range.
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
Let's solve tasks!
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
Let's solve advanced tasks!
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
Welcome!
Programming
12 grade
Show answer
Auto Play
Slide 1 / 23
SLIDE
Similar Resources on Wayground
18 questions
PR1 Module 1
Presentation
•
12th Grade
21 questions
6.3 Ferrous Metals
Presentation
•
12th Grade
18 questions
GP - Grade 11: Drawing Conclusions from Visual Evidence
Presentation
•
11th Grade
18 questions
Cyberstart Intern Base Level 1
Presentation
•
12th Grade
16 questions
How much do you know about the “Panama Hat?
Presentation
•
12th Grade
18 questions
Protecting Your Data in the Online World
Presentation
•
12th Grade
18 questions
3.2.8 End Of The Day
Presentation
•
12th Grade
20 questions
Tragedy
Presentation
•
12th Grade
Popular Resources on Wayground
16 questions
Grade 3 Simulation Assessment 2
Quiz
•
3rd Grade
19 questions
HCS Grade 5 Simulation Assessment_1 2526sy
Quiz
•
5th Grade
10 questions
Cinco de Mayo Trivia Questions
Interactive video
•
3rd - 5th Grade
17 questions
HCS Grade 4 Simulation Assessment_2 2526sy
Quiz
•
4th Grade
24 questions
HCS Grade 5 Simulation Assessment_2 2526sy
Quiz
•
5th Grade
13 questions
Cinco de mayo
Interactive video
•
6th - 8th Grade
20 questions
Math Review
Quiz
•
3rd Grade
30 questions
GVMS House Trivia 2026
Quiz
•
6th - 8th Grade
Discover more resources for Other
5 questions
A.EI.1-3 Quizizz Day 1
Quiz
•
9th - 12th Grade
210 questions
Unit 1 - 4 AP Bio Review
Quiz
•
9th - 12th Grade
100 questions
Biology EOC Review
Quiz
•
9th - 12th Grade
5 questions
A.EI.1-3 Quizizz Day 2
Quiz
•
9th - 12th Grade
5 questions
A.EI.1-3 Quizizz Day 4
Quiz
•
9th - 12th Grade
16 questions
AP Biology: Unit 1 Review (CED)
Quiz
•
9th - 12th Grade
5 questions
G.PC/DF Quizizz Day 2
Quiz
•
9th - 12th Grade
20 questions
verbos reflexivos en español
Quiz
•
9th - 12th Grade