Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
- Students must be displayed on the monitor, sorted by their average. The name and average of each student should appear- use the bubble sort function

- They must display the name of the student (and respective average) of the student with the best average on the monitor.

- They must display the name of the student (and respective average) of the student with the lowest average on the monitor.

What I have tried:

num_students = eval(input("How many students are in the class? "))
num_grades = eval(input("How many subjects do the students have? "))
name = []
name = [0]*num_students
grade = []
grade = [0]*num_grades
name_subjects = []
subjects = [0]*num_subjects

for i in range (num_students):
nome[i] = input("Name of the student: ")
for j in range (num_grades):
nota[j] = input("Grade of the student: ")

print ("The class average is", average)


if grade[j] > average:
print("Congradulations!", name[i])
Posted
Updated 21-Nov-22 22:14pm
v2
Comments
OriginalGriff 22-Nov-22 1:58am    
And?
What does it do that you didn't expect, or not do that you did?
What have you tried to do to find out why?
Are there any error messages, and if so, where and when? What did you do to make them happen?

This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
Use the "Improve question" widget to edit your question and provide better information.
Member 15807303 22-Nov-22 4:23am    
I know my code is incomplete. I have this important assignment that I can't seem to understand how to make it and I've been in it for five days. It's been only two months since I starded coding. I've put all the things I know in this code.
If someone could explain and show to me how it's done I'd appreciate it alot.
Thank you! (Sorry for my english)

A quick look at the code says you haven't exactly thought about it too much before you dived into code: an average isn't calculated like that.

To calculate an average, you sum all the values, and then divide that by the number of items you added together.
Since you read the number of students and subjects from the user, why are you later assuming that a class has 30 students, and each has 5 subjects?
Even if that was right, class has no information in it at all.

Back that up so you can look at it later and realize just how bad it is, then delete it and start again. Read the assignment carefully, and work out what you need to do in small stages. This may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Your program is incomplete, features syntax errors, and possibly a bit off topic (subjects?).
Try harder to implement correctly at least the averaging code and ask here specific questions whenever you really need.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900