COURSE SECTION 05 OF 06
Random Modules and Built-in Functions
Lesson material assembled from the files you supplied.
Course notes
Content below is transcribed from the supplied course document. The original wording and terminology are retained.
Random Modules and Built-in Function
Random Module:-
Random functions for integers
randint()
randrange()
Random functions for sequence
Choice(rnlist)
shuffle()
Sample()
Random functions for floats
random()
Uniform(start, end)
Tombola game
Number must be interger
Ranges from 1 to 100
Non-repeatable
OTP generator
OTP must contain the numbers and letters
OTP length should be 6
Python special functions:-
Lambda()
lambda can take any number of arguments and retuens only one expression
filter()
map()
reduce()
isinstance()
eval()
repr()
Download the supplied Python examples
Topics identified in the course materials
- Random Module
- randint() and randrange()
- choice(), shuffle() and sample()
- Random Floating-Point Values
- Tombola Game and OTP Generator