I'm working on a program that takes student names and grades from a .txt file and produces results. The text file has this type of form:
Darnell 96 54 94 98 76
Brody 50 65 65 65 70
Anna 76 54 76 76 76
Conor 95 95 95 95
I want the first line of the output to show the names of students, like so:
Name of students in class:
Anna Brody Conor Darnell
My current code is
f = open(argv[1])
while True:
line = f.readline().strip()
if line:
print(line)
I know I need to used the sorted()
function. However, when I try to do implement it I just make a mess of the code.
I know theres similar questions out there. However, being new to python some are way over my head. Any little bit of information helps. Thanks!