Practical_12
Practical_12
Sr. Remark if
Name of Resource Broad Specification Quantity
No. any
1 Computer System Intel i3, 4 GB RAM
For All
2 Operating System Windows/Linux 20
Experiments
3 Development Software Python IDE And VS Code
Expected Output:
1709062923.123456 # (This value will change based on the current timestamp)
1970-01-06 # (Fixed output for given timestamp)
Explanation:
1. time.time()
o Returns the current time in seconds since epoch (Jan 1, 1970, 00:00:00 UTC).
o The value changes every time the program runs.
2. date.fromtimestamp(454554)
o Converts the given timestamp 454554 (seconds since epoch) into a readable date.
o 454554 seconds from Jan 1, 1970, results in January 6, 1970 (1970-01-06).
1. Write a Python program to create a user defined module that will ask your college name
and will display the name of the college.
How It Works:
1. The college.py module contains the function get_college_name(), which asks for the
college name and displays it.
2. In main.py, we import the college module and call college.get_college_name().
3. When you run main.py, it will prompt you to enter your college name, then display it.
Example Output:
Enter your college name: Jamia Polytechnic
Your college name is: Jamia Polytechnic
2. Write a Python program that will calculate area and circumference of circle using
inbuilt Math Module
The area and circumference of a circle using the inbuilt math module:
import math
# Input radius
radius = float(input("Enter the radius of the circle: "))
# Display results
print("Area of the circle:", area)
print("Circumference of the circle:", circumference)
Example Output:
Enter the radius of the circle: 5
Area of the circle: 78.53981633974483
Explanation:
1. math.pi → Provides the value of π (3.141592653589793).
2. Area formula: πr²
3. Circumference formula: 2πr
3.Write a Python program that will display Calendar of given month using Calendar
Module
import calendar
# Input year and month
year = int(input("Enter the year: "))
month = int(input("Enter the month (1-12): "))
# Display calendar
print(calendar.month(year, month))
Example Output:
Enter the year: 2025
Enter the month (1-12): 2
February 2025
Mo Tu We Th Fr Sa Su
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28
Explanation:
1. calendar.month(year, month) → Displays the calendar of the given month.
2. The user enters the year and month, and the program prints the calendar.