python41
python41
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d65173… 1/11
7/27/24, 9:52 PM Revolutionizing the Job Market | NxtWave
Standard Library
Built-in Functions
1. print()
2. max()
3. min()
Standard Library
1. collections
2. random
3. datetime
1 import module_name
Math Module
Code
PYTHON
1 import math
2 print(math.factorial(5))
3 print(math.pi)
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d65173… 3/11
7/27/24, 9:52 PM Revolutionizing the Job Market | NxtWave
Output
120
3.141592653589793
Importing module
Code
PYTHON
1 import math as m1
2 print(m1.factorial(5))
Output
120
Code
PYTHON
Output
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d65173… 4/11
7/27/24, 9:52 PM Revolutionizing the Job Market | NxtWave
120
Aliasing Imports
Code
PYTHON
Output
120
Random module
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d65173… 5/11
7/27/24, 9:52 PM Revolutionizing the Job Market | NxtWave
Randint
Code
PYTHON
1 import random
2 random_integer = random.randint(1, 10)
3 print(random_integer)
Output
Choice
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d65173… 6/11
7/27/24, 9:52 PM Revolutionizing the Job Market | NxtWave
Code
PYTHON
1 import random
2 random_ele = random.choice(["A","B","C"])
3 print(random_ele)
Output
Map
map() applies a given function to each item of a sequence (list, tuple etc.)
and returns a sequence of the results.
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d65173… 7/11
7/27/24, 9:52 PM Revolutionizing the Job Market | NxtWave
Example - 1
Code
PYTHON
1 def square(n):
2 return n * n
3 numbers = [1, 2, 3, 4]
4 result = map(square, numbers)
5 numbers_square = list(result)
6 print(numbers_square)
Output
[1, 4, 9, 16]
Example - 2
Code
PYTHON
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d65173… 8/11
7/27/24, 9:52 PM Revolutionizing the Job Market | NxtWave
Input
1 2 3 4
Output
[1, 2, 3, 4]
Filter
Code
PYTHON
1 def is_positive_number(num):
2 return num > 0
3
4 list_a = [1, -2, 3, -4]
5 positive_nums = filter(is_positive_number, list_a)
6 print(list(positive_nums))
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d65173… 9/11
7/27/24, 9:52 PM Revolutionizing the Job Market | NxtWave
Output
[1, 3]
Reduce
Code
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d6517… 10/11
7/27/24, 9:52 PM Revolutionizing the Job Market | NxtWave
PYTHON
Output
10
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=7f553143-459d-43df-a3fb-4749ed732353&s_id=4d65173… 11/11