I need help with my code, sorry for this easy questions because I am very new to python especially when it comes to listing. So what I want for my result is that the two names would be in the leaderboard list. (It will have more names in the textfile in the future)
So can anyone help me to display different names in the list thank you.
scoring = {"Name": "", "WinStreak": 0}
leaderboard = []
count = 0
tester = 0
with open("testing2.txt", "r") as fileText:
for line in fileText:
scoring["Name"] = line.split()[0]
winning = int(line.split()[2])
scoring["WinStreak"] = winning
leaderboard.append(scoring)
for display in leaderboard:
print(display["Name"], "-", display["WinStreak"])
testing2.txt
John , 2
Michael , 3
Actual Outcome
Michael - 3
Michael - 3
Expected Output
John - 2
Michael - 3