0% found this document useful (0 votes)
1 views2 pages

Python 1

The document contains two Python programs. The first program reads student details, calculates total marks and percentage, and displays the information. The second program reads a person's name and year of birth to determine if they are a senior citizen based on their age.

Uploaded by

shilpa shree
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)
1 views2 pages

Python 1

The document contains two Python programs. The first program reads student details, calculates total marks and percentage, and displays the information. The second program reads a person's name and year of birth to determine if they are a senior citizen based on their age.

Uploaded by

shilpa shree
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/ 2

1. a.

Develop a program to read the student details like Name, USN, and Marks in three
subjects. Display the student details, total marks and percentage with suitable messages.

stName = input("Enter the name of the student : ")

stUSN = input("Enter the USN of the student : ")

stMarks1 = int(input("Enter marks in Subject 1 : "))

stMarks2 = int(input("Enter marks in Subject 2 : "))

stMarks3 = int(input("Enter marks in Subject 3 : "))

print("Student Details\n=========================")

print("%12s"%("Name :"), stName)

print("%12s"%("USN :"), stUSN)

print("%12s"%("Marks 1 :"), stMarks1)

print("%12s"%("Marks 2 :"), stMarks2)

print("%12s"%("Marks 3 :"), stMarks3)

print("%12s"%("Total :"), stMarks1+stMarks2+stMarks3)

print("%12s"%("Percent :"), "%.2f"%((stMarks1+stMarks2+stMarks3)/3))

print("=========================")

OUTPUT:
1. b. Develop a program to read the name and year of birth of a person. Display whether the
person is a senior citizen or not.

from datetime import date

perName = input("Enter the name of the person : ")


perDOB = int(input("Enter his year of birth : "))

curYear = date.today().year
perAge = curYear - perDOB

if (perAge > 60):


print(perName, "aged", perAge, "years is a Senior Citizen.")
else:
print(perName, "aged", perAge, "years is not a Senior Citizen.")

OUTPUT:

You might also like