Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialyoussef b10ta
Courses Plus Student 2,755 PointsHere 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
3,629 Pointsgreat 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!
youssef b10ta
Courses Plus Student 2,755 Pointsyoussef b10ta
Courses Plus Student 2,755 PointsThank you Eldin Guzin :)