Python program to find best of two test average marks

Python program to find the best of two test average mark’s out of three test marks accepted from the user

Problem Definition

Develop a python program to find the best of two test average marks out of three test marks accepted entered by the user.

Video Tutorial:

Source code of Python program to find best of two test average marks

m1 = int (input("Enter the marks in the first test: "))
m2 = int (input("Enter the marks in second test: "))
m3 = int (input("Enter the marks in third test: "))

if (m1 > m2):
    if (m2 > m3):
        total = m1 + m2
    else: 
        total = m1 + m3
elif (m1 > m3):
    total = m1 + m2
else:
    total = m2 + m3
    
Avg = total / 2
print ("The average of the best two test marks is: ",Avg)

Output:

Case 1:

Enter the marks in the first test: 20

Enter the marks in the second test: 15

Enter the marks in the third test: 22

The average of the best two test marks is: 21.0

See also  Python program to find the area and perimeter of a rectangle

Case 2:

Enter the marks in the first test: 20

Enter the marks in the second test: 23

Enter the marks in the third test: 18

The average of the best two test marks is: 21.5

Case 3:

Enter the marks in the first test: 15

Enter the marks in the second test: 20

Enter the marks in the third test: 21

The average of the best two test marks is: 20.5

Summary:

This tutorial discusses how to develop a program to find the best of two test average marks out of 3 tests accepted entered by the user. If you like the tutorial share it with your friends. Like the Facebook page for regular updates and YouTube channel for video tutorials.

Leave a Comment

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