Python Program that Accepts Marks in 5 Subjects and Outputs Average Marks

Program to calculate total marks and percentage of five subjects in python; In this python post, you will learn how to write program to calculate total marks and percentage of 5 subjects in python

Python Program to find Total Average and Percentage of Five Subjects

Follow the following algorithm to write a program to calculate total marks and percentage of five (5) subjects in python program:

  • Allow users to enter five different marks for five subjects.
  • Sum all subjects marks using the arithmetic operator.
  • Calculate average using this formula average = total / 5 .
  • And calculate percentage using this formula: percentage = (total / 500) * 100.
  • Print result.
# Python Program to find Total, Average, and Percentage of Five Subjects

english = float(input("Please enter English Marks: "))
math = float(input("Please enter Math score: "))
computers = float(input("Please enter Computer Marks: "))
physics = float(input("Please enter Physics Marks: "))
chemistry = float(input("Please enter Chemistry Marks: "))

total = english + math + computers + physics + chemistry
average = total / 5
percentage = (total / 500) * 100

print("\nTotal Marks = %.2f"  %total)
print("Average Marks = %.2f"  %average)
print("Marks Percentage = %.2f"  %percentage)

After executing the program, the output will be:

Please enter English Marks:  80
Please enter Math score:  90
Please enter Computer Marks:  78
Please enter Physics Marks:  89
Please enter Chemistry Marks:  87

Total Marks = 424.00
Average Marks = 84.80
Marks Percentage = 84.80

Recommended Python Programs

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

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