```python
inputfile=open("ALE.txt","r")
outputfile=open("ALE2.txt","w")
list1=[]
for line in inputfile:
Team,Won,Lost=line.split(',')
Won=int(Won)
Lost=int(Lost)
Percentage=round((Won)/(Won+Lost),3)
list1.append([Percentage,Team,Won,Lost])
list1.sort(reverse=True)
print("Team\tWon\tLost\tPercentage")
for i in range(len(list1)):
outputfile.write("{0:<10},{1:<10},{2:<10},{3:<10}".format(list1[i][2],list[i][3],list[i][4],list[i][0]))
inputfile.close() outputfile.close()
ALE 안에 있는 자료는 다음과 같아요. 문제에선 Percentage를 내림차순으로 정렬해야한다 해서 `list.sort(reverse=True)`를 넣었어요.
``` 문제의 의도는 ALE안의 자료를 위에 있는 사진처럼 ALE2에 옮겨야 해요. ALE의 내용은 밑에 있는 것과 같은데 줄과 줄 사이에는 원래 공백이 없어요.
Baltimore,93,69
Boston,69,93
New York,95,67
Tampa Bay,90,72
Toronto,73,89
어느 부분에서 틀렸고 고쳐야 하는 방법도 알려주시면 정말 감사하겠습니다. ㅠㅠ