print(math.pi) # 3.141592653589793
print(math.e) # 2.718281828459045
print(math.sqrt(16)) # 4.0
print(math.ceil(4.1)) # 5
print(math.floor(4.9)) # 4
print(math.factorial(5)) # 120
print(math.gcd(12, 18)) # 6
print(math.log2(8)) # 3.0
print(math.inf) # Infinity
random.seed(42) # Reproducible results
print(random.random()) # 0.0 to 1.0
print(random.randint(1, 10)) # 1 to 10 (inclusive)
print(random.uniform(1.5, 5.5)) # 1.5 to 5.5
# Choose from sequence
print(random.choice(['a', 'b', 'c']))
print(random.choices([1,2,3], weights=[10,1,1], k=4)) # Weighted with replacement
print(random.sample(range(100), 5)) # 5 unique random items
# Shuffle in-place
cards = ['A', 'K', 'Q', 'J']
random.shuffle(cards)
# Current time
now = datetime.now()
today = date.today()
# Create specific date
dob = date(1995, 5, 15)
# Date arithmetic
future = now + timedelta(days=30)
past = now - timedelta(hours=2)
# Difference (returns timedelta)
diff = now - dob
print(diff.days) # Days between dates
# Formatting (datetime → string)
print(now.strftime('%Y-%m-%d %H:%M:%S')) # '2024-01-15 14:30:00'
# Parsing (string → datetime)
parsed = datetime.strptime('2024/01/15', '%Y/%m/%d')
# Paths
print(os.getcwd()) # Current directory
os.chdir('/tmp') # Change directory
print(os.path.exists('file.txt')) # True/False
print(os.path.isfile('file.txt')) # Is it a file?
print(os.path.isdir('folder')) # Is it a directory?
# Path manipulation (prefer os.path over string concat)
full_path = os.path.join('folder', 'subfolder', 'file.txt')
print(os.path.basename(full_path)) # 'file.txt'
print(os.path.dirname(full_path)) # 'folder/subfolder'
# Environment variables
print(os.environ.get('PATH'))
os.environ['MY_VAR'] = 'value'
# List directory
print(os.listdir('.'))
print(sys.argv) # Command line arguments
print(sys.version) # Python version
print(sys.platform) # 'linux', 'win32', 'darwin'
print(sys.getsizeof([1,2,3])) # Memory size in bytes
sys.exit(0) # Exit scriptCreate a function `generate_password(length=12)` that generates a secure random password containing uppercase, lowercase, digits, and symbols. Use `random.SystemRandom()` for cryptographic security (don't use plain `random`). Create a function `days_until(target_date_str)` that takes a 'YYYY-MM-DD' string and returns the number of days from today.