The last make task of the chapter, and the one that needs a loop inside a loop.
A local sports club stores the full names of its team members in a list. They need a program that turns every name into its initials.
So that the output can be checked automatically, the names are fixed. Start your program with exactly this line:
players = ["Alex Smith", "Jordan Taylor", "Sam Brown"]
Write a program that:
" "),The first initial is always the first character of the name. The last initial is the character straight after the space, and the space can be anywhere, because first names have different lengths. That is what the inner loop is for: it finds out where the space is in this particular name.
The tests also check your code: a program that does not have a for loop
inside a for loop, or that does not call upper(), does not pass.
One line per player, in the order they are in the list, each holding two capital letters and nothing else:
AS
JT
SB
Make sure that you check for the following things:
range(len(players)) and picks out one full name
each time round.print belongs to the outer loop, not the inner one, so it runs once
per player. Printing inside the inner loop prints far too many lines.+ and no space in between.