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 trial

Python Challenge Solution

Mohammed Saleh
seal-mask
.a{fill-rule:evenodd;}techdegree
Mohammed Saleh
Python Development Techdegree Student 2,989 Points

invalid syntax

players = []

adding_player = input("would you like to add a player? YES/NO") while adding_player.lower()== "yes": name = input("enter the player name, please") players.append(name) adding_player = input("would you like to add another player? yes/no")

print(" there are {} players".format(len(players))

player_number = 1 for player in players: print("player{}:{}".format(player_number, player)) player_number += 1

keeper = input("enter the player number you wish to be the goalkeeper? (1-{}) ".format(len(players)))
keepr=int(keeper)

print(" the goal keeper will be {}".format(players[keeper-1])) ...

i'm getting invalid syntax at the ..player_number = 1 why it is not valid syntax, it is just a variable and a number assigned to it. thanks.

1 Answer

In the line right before you got a syntax error, print(" there are {} players".format(len(players)) , you have three opening parentheses and two closing parentheses. Try adding another closing parenthesis.