About Lesson
Overview of Commonly Used Libraries
- math: Provides mathematical functions and constants.
- Functions:
sqrt()
,pow()
,sin()
,cos()
,log()
, etc. - Constants:
pi
,e
.
python
import math print(math.sqrt(16)) # Output: 4.0 print(math.pi) # Output: 3.141592653589793
- Functions:
- datetime: Supplies classes for manipulating dates and times.
- Classes:
date
,time
,datetime
,timedelta
. - Methods:
today()
,now()
,strftime()
,strptime()
.
python
from datetime import datetime now = datetime.now() print(now.strftime("%Y-%m-%d %H:%M:%S")) # Output: Current date and time
- Classes: