Programming With Python Practical 12

Question 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.
college.py
def getcollege():
	cname=input("Enter your college name: ")
	print("Your college name is: ",cname)
collegemain.py
import college
college.getcollege()
Output
Question 2
Write a Python program that will calculate area and circumference of circle using inbuilt Math Module
circle.py
import math

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

area = math.pi*r**2
circumference = 2*math.pi*r

print(f"Area of the circle: ",area)
print(f"Circumference of the circle: ",circumference)
Output
Question 3
Write a Python program that will display Calendar of given month using Calendar Module
cal.py
import calendar

yy = int(input("Enter year: "))
mm = int(input("Enter month: "))

print(calendar.month(yy, mm))
Output

Leave a Comment

Your email address will not be published. Required fields are marked *