Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views4 pages

PWPPractical No 12

The document outlines a practical assignment for a Python programming course, focusing on the use of built-in and user-defined modules. It includes sample code snippets for various functionalities such as mathematical operations, random number generation, and date/time manipulation, along with exercises to create a user-defined module and calculate area and circumference of a circle. Additionally, it provides a task to display a calendar for a given month using the Calendar module.

Uploaded by

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

PWPPractical No 12

The document outlines a practical assignment for a Python programming course, focusing on the use of built-in and user-defined modules. It includes sample code snippets for various functionalities such as mathematical operations, random number generation, and date/time manipulation, along with exercises to create a user-defined module and calculate area and circumference of a circle. Additionally, it provides a task to display a calendar for a given month using the Calendar module.

Uploaded by

Shivraj Chougule
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical No : 12

Name: Shivraj Prakash Chougule Roll No.12

Practical Name : Write Python program to demonstrate use of:


a) Built-in module (e.g. keyword, math, number, operator)
b) User defined module

Q.1) What is the output of the following program?

Code :
import math
print math.sqrt(25)
print math.pi
print math.degrees(2)
print math.radians(60)
print math.sin(2)
print math.cos(0.5)
print math.tan(0.23)
print math.factorial(4)

Output :

Q.2) What is the output of the following program?

Code :
import random

print(random.randint(0, 5))
print(random.random())
print(random.random() * 100)
List = [1, 4, True, 800, "Python", 27, "hello"]
print(random.choice(List))

Output :
Q3) What is the output of the following program?

Code :
import datetime
from datetime import date
import time

print(time.time())
print(date.fromtimestamp(454554))

Output :

Exercise:

Q.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.

Code :
main.py :
import college

college_name = college.college_name()
print("Your college name is:", college_name)

College.py:

def college_name():
college_name = input("Enter your college name: ")
return college_name

Output :
Q.2)Write a Python program that will calculate area and circumference of circle using inbuilt Math Module

Code :
import math

radius = float(input("Enter the radius of the circle: "))

area = math.pi * radius ** 2


circumference = 2 * math.pi * radius

print("Area:", area)
print("Circumference:", circumference)

Output :

Q.3) Write a Python program that will display Calendar of given month using Calendar Module

Code :
import calendar

year = int(input("Enter the year (e.g. 2025): "))


month = int(input("Enter the month (1-12): "))

print(calendar.month(year, month))

Output :

You might also like