Alright, so i got this question that im given a group of scores in the file, and i have to make them into a list, sort the list, and find the median. I got the sorting and the median done..
But I just got one problem that I can't seem to figure out. Here is my code:
I'm new to python..i know i can use sort() and everything..but is there a way to solve the problem with the code i used?:)
#Text file in another file:
score.txt
10,11,09,10,22,22,20,01
def elements(score_file):
line = score_file.readline().strip()
score = line.split(",")
while line != "":
line = score_file.readline().strip()
score = score + line.split(",")
print("Original list:")
print(score)
return score
#The ouput i get for the orginal list comes up to(How do i get rid of the '' at the end?):
Original list:
['10', '11', '09', '10', '22', '22', '20', '01', '']
THANKS ALOT GUYS!!