A program that reads the records from the golf txt file and displays them

In Python Language do the following:

The Springfork Amateur Golf Club has a tournament every weekend. The club president has
asked you to write two programs:
1. A program that will read each player’s name and golf score as keyboard input, then save
these as records in a file named golf.txt. (Each record will have a field for the player’s
name and a field for the player’s score.)
2. A program that reads the records from the golf.txt file and displays them.

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

I am working on homework and have tried many variations of this code but MyProgrammingLab
doesn’t seem to accept any of them. I am told it needs an “if statement” but I am so burnt out and not really sure where it should go at this point.

The question is this:

Blockquote
Write a program that reads the records from the golf.txt file written in Exercise
10a and prints them in the following format:

Name: Emily
Score: 30

Name: Mike
Score: 20

Name: Jonathan
Score: 23

This is what I have

def main():
    data = open('golf.txt', 'r')

    name = data.readline()

    name = name.rstrip('\n')
    score = ''
    while name !='':

        score = data.readline()

        print('Name:', name)
        print('Score:', score)

        name = data.readline()

        name = name.rstrip('\n')
    data.close()
main()