Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Challenge Solution

youssef b10ta
PLUS
youssef b10ta
Courses Plus Student 2,754 Points

Here is My Aprproach

players = []
answer = 'yes'
while answer == 'yes':
        answer = input('Would you like to add a player to your list yes|no  ').lower()
        if answer == 'yes':
            add_name = input('Enter the name of the player you like like to add ')
            players.append(add_name)
print('The number of the players on this team is {}'.format(len(players)))
count = 0
while count < len(players):
    print('Player {}: {}'.format(count+1 , players[count]))
    count += 1
goalkeeper = int(input('Please Select a goalkeeper from 1-{}  '.format(len(players))))
print('The Goalkeeper for this game will be {}'.format(players[goalkeeper-1]))
HAROLD MORI
HAROLD MORI
3,629 Points

great code!, but just a correction (btw innecesary but it's always up to what actually is asking)

the first question is "Would you like to add 'A' player" next ones are "Would you like to add 'ANOTHER' player"

as I repeat it's innecesary but sometimes clients are picky.

again nice, code!

1 Answer

Nice work!,That really is a unique way of approaching this :D