1 A, B Python Program
1 A, B Python Program
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.
AIM:
To develop a program to read the student details like Name, USN, and Marks in three subjects, and to Display the
student details, total marks and percentage with suitable messages.
ALGORITHM:
1. The program starts by asking the user to input the student's details such as name, USN (University
Serial Number), and marks in three subjects.
2. It calculates the total marks obtained by adding the marks in all three subjects and then calculates the
percentage by dividing the total marks by 300 (assuming each subject has a maximum of 100 marks)
and multiplying by 100.
3. The program then prints the student's details, marks in each subject, total score, and percentage.
4. Next, it uses conditional statements (if-elif-else) to determine the class based on the percentage
obtained:
If the percentage is 90 or above, it prints "First Class Exemplary."
If the percentage is between 75 and 89, it prints "First Class with Distinction."
If the percentage is between 60 and 74, it prints "First Class."
If the percentage is between 35 and 59, it prints "Second Class."
If the percentage is below 35, it prints "Fail."
5. Finally, the program displays the appropriate class message based on the percentage obtained by the
student.
PROGRAM:
studentname = input('Enter the Name of the student: ')
usn = input('Enter the USN of the student: ')
m1 = int(input('Enter the mark in the first subject: '))
m2 = int(input('Enter the mark in the second subject: '))
m3 = int(input('Enter the mark in the third subject: '))
total = m1 + m2 + m3
percentage = round((total / 300) * 100)
AIM: To develop a program for reading the name and year of birth of a person and to display whether the person
is a senior citizen or not.
ALGORITHM:
1. The program starts by asking the user to input the name of the person and their year of birth.
2. It calculates the person's age by subtracting the input year of birth from the current year, which is set as
2024 (current_year - year_of_birth = age).
3. The program then prints the person's name, year of birth, and calculated age using print statements.
These statements are formatted to display the information clearly.
4. Next, the program uses an if-else statement to determine whether the person is a senior citizen or not.
The condition if age >= 60: checks if the calculated age is 60 years or older. If the condition is true, it
prints "The person is a Senior Citizen." Otherwise, it prints "The person is not a Senior Citizen."
PROGRAM:
person_name = input('Enter the Name of the person: ')
year_of_birth = int(input('Enter the Year of Birth: '))
current_year = 2024
age = current_year - year_of_birth
OUTPUT:
Enter the Name of the person: John Doe
Enter the Year of Birth: 1955