Introduction to Python Programming Lab Programs Draft 1
Introduction to Python Programming Lab Programs Draft 1
LAB MANUAL
For Physics cycle in 2025 MVJCE
Programs along with output
LAB-1
Part A
Develop a program to read the student details like name, USN and marks in 3 subjects.
Display the student details, total marks and percentage with suitable messages.
USN=input(" Enter Usn ")
name=input(" Enter Name:")
print(" Enter Marks Of 3 Subjects ")
marks=[] # define an Empty list marks
for i in range(3):
m=int(input(" Enter The Marks :"))
marks.append((m)) # load the values to list marks using append method
print(marks)
total=sum(marks) # calculate the total by using sum() function and store it in variable total
per=int(100*total)/300 # calculate the percentage and store it in variable per
print(USN,name,total,per)
Algorithm:
1. Start
2. Input USN
• Prompt the user to enter the USN and store it in a variable USN.
3. Input Name
• Prompt the user to enter their Name and store it in a variable name.
8. Calculate Percentage
• Compute the percentage using the formula:
• Store the result in the variable per.
Output:
Enter USN: 1ABC24XY123
Enter Name: Ralph
Enter Marks of 3 Subjects
Enter The Marks: 30
Enter The Marks: 40
Enter The Marks: 50
Marks: [30, 40, 50]
USN: 1ABC24XY123
Name: Ralph
Total Marks: 120
Percentage: 40.0
Part 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.
import datetime
Algorithm:
Algorithm to Determine Senior Citizen Status
1. Start
2. Input: Prompt the user to enter their name.
3. Input: Prompt the user to enter their year of birth and store it as an integer.
4. Process: Get the current year using the system's date.
5. Calculate Age:
• Subtract the year of birth from the current year to find the age.
6. Decision: Check if the age is greater than or equal to 60.
• If True: Print "{name}, you are a senior citizen."
• If False: Print "{name}, you are not a senior citizen."
7. End
Output:
Enter your name: Ralph
Enter your year of birth: 1951
Ralph, you are a senior citizen