Below is a simple Python program that takes the name of the student and their marks in three subjects as input, calculates the average marks, and finds the maximum marks among the three subjects:
```python
def calculate_average(marks_list):
return sum(marks_list) / len(marks_list)
def find_maximum(marks_list):
return max(marks_list)
def main():
student_name = input("Enter the name of the student: ")
marks_subject1 = int(input("Enter the marks obtained in Subject 1: "))
marks_subject2 = int(input("Enter the marks obtained in Subject 2: "))
marks_subject3 = int(input("Enter the marks obtained in Subject 3: "))
print("\nAverage marks of three subjects:", average_marks)
print("Maximum marks among three subjects:", maximum_marks)
if __name__ == "__main__":
main()
```
Copy and paste this code into a Python environment, run the program, and it will prompt you to enter the student's name and marks in three subjects. Then, it will calculate and display the average marks of the three subjects and the maximum marks obtained among them.
Answers & Comments
Verified answer
Explanation:
Below is a simple Python program that takes the name of the student and their marks in three subjects as input, calculates the average marks, and finds the maximum marks among the three subjects:
```python
def calculate_average(marks_list):
return sum(marks_list) / len(marks_list)
def find_maximum(marks_list):
return max(marks_list)
def main():
student_name = input("Enter the name of the student: ")
marks_subject1 = int(input("Enter the marks obtained in Subject 1: "))
marks_subject2 = int(input("Enter the marks obtained in Subject 2: "))
marks_subject3 = int(input("Enter the marks obtained in Subject 3: "))
marks_list = [marks_subject1, marks_subject2, marks_subject3]
average_marks = calculate_average(marks_list)
maximum_marks = find_maximum(marks_list)
print("\nAverage marks of three subjects:", average_marks)
print("Maximum marks among three subjects:", maximum_marks)
if __name__ == "__main__":
main()
```
Copy and paste this code into a Python environment, run the program, and it will prompt you to enter the student's name and marks in three subjects. Then, it will calculate and display the average marks of the three subjects and the maximum marks obtained among them.