# Modules in Python # 1-math # 2-keywords # 3-random # 4-datetime # math import math print(math.factorial(5)) print(math.floor(6.8)) print(math.sqrt(196)) Result: 120 6 14.0 # keyword import keyword print(keyword.kwlist) Result: ['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield'] # random import random print(random.randint(1,100)) Result:48 # datetime import datetime print(datetime.datetime.now()) Result: 2024-01-13 15:42:37.384551 help('modules')
Comments
Post a Comment