Practice Problem

We have to read the student details like their name and three course marks. Then we have to find total marks individually. Now have to display the top 3 students in class based on their total marks.

I have coded some as “n” is no of students and a,b,c as three courses marks. d as total marks

Can u please guide me to complete this problem?

Hello @deepu007, you need to make a list that consists the name of the student and his total marks and then you need to sort the list on the basis of the total marks and then print the name of those 3 students.
You can go like, take the names list as you have done.
Then take the marks as well and create that in the list as (total marks,student_name) and then sort the full list on the basis of the highest marks.
Like this, you will get the list in the marks in descending order and then corresponding name.
I hope it is clear to you. In case there is any confusion pls let me know.
In case it is clear to you, pls mark it as resolve and feel free to provide the feedback.
Thanks :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Also how to create the list of the total marks and names
They are in a loop right
That is where i have been stuck

Hello @deepu007, can you pls share your code that I can edit or where I can write the comments?

code: https://ide.codingblocks.com/s/388149

Hello @deepu007, you can refer this link https://ide.codingblocks.com/s/388566
I have corrected the code and at last, returning the list according to the highest marks first.
Now you need to pick the top 3 students.
I hope it is clear to you, in case you feel any issue pls let me know.
And if it is clear to you pls mark it as resolve.
Thanks :slight_smile: