Displaying a leader board from a text file and calculating points The text file is laid out like this: first name, last name, wins, losses

dex,kop,5,6

desder,jok,0,11

aslan,vert,11,0

jax,sas,2,9

buy,guy,1,10


Code:

def points():

    template = "|{0:&lt;30}|{1:&lt;30}|{2:&lt;30}|{3:&lt;30}|{4:&lt;30}"
    lol = template.format("1st name: ","2nd Name: ", "won: ", "lost: ","points: ")

    print(lol)

    with open(r'prac2.txt', 'r') as file:

        for line in file:

            data = line.strip().split(',')

            if int(data[2]) &gt;= 1:

                poin = int(data[2]) * 3

                data.append(poin)

                print(template.format(data[0], data[1], data[2], data[3], data[4]),'\n')

        file.close()

points()


The program should only display players that have won at least 1 game and calculate their points, a win is equal to 3 points.

Any suggestions as to how to improve the code any would be great.
Since you are using all the elements of data,  You can turn:

print(template.format(data[0], data[1], data[2], data[3], data[4]))


into this:

print(template.format(*data))


See here for some details.