0% found this document useful (0 votes)
6 views1 page

Simple Python Codes with Built-in Libraries

The document provides simple Python code examples using built-in packages. It includes examples for finding square roots, generating random numbers, getting the current date and time, calculating averages, and printing a month calendar. Each example is accompanied by the relevant import statement and print function.

Uploaded by

hihihih
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Simple Python Codes with Built-in Libraries

The document provides simple Python code examples using built-in packages. It includes examples for finding square roots, generating random numbers, getting the current date and time, calculating averages, and printing a month calendar. Each example is accompanied by the relevant import statement and print function.

Uploaded by

hihihih
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Simple Python Codes Using Built-in

Packages
1. Using math – Find Square Root
import math

print("Square root of 25 is:", [Link](25))

2. Using random – Generate Random Number


import random

print("Random number between 1 and 100:", [Link](1,


100))

3. Using datetime – Get Current Date and Time


import datetime

now = [Link]()
print("Current date and time:", now)

4. Using statistics – Find Average


import statistics

marks = [85, 90, 78, 92, 88]


average = [Link](marks)
print("Average marks:", average)

5. Using calendar – Print a Month Calendar


import calendar

print([Link](2025, 6))

You might also like