Tennis tournament

Report a typo

Several warm-up matches have been played at the tennis tournament. You have data on the victories and losses of some players. Your task is to save the names of the winners to a list.

The input format:

On the first line, you'll receive the integer n specifying a number of lines.

The next n lines will look like either Name win or Name loss.

The output format:

Print out the list of all players that have won a match, repeat the names if necessary.

You can use "Name win".split() to get a list with the strings ["Name", "win"].

Sample Input 1:

2
Borg win
McEnroe loss

Sample Output 1:

['Borg']

Sample Input 2:

4
McEnroe win
Borg loss
McEnroe win
Connors win

Sample Output 2:

['McEnroe', 'McEnroe', 'Connors']
Write a program in Python 3





___

Create a free account to access the full topic