Python Challenge Solution

Sean Flanagan
Sean Flanagan
33,223 Points

What's the difference between Ken's while loop and my if statement?

# If the user answers "Yes", let them type in a name and add it to the list.
if (add_player.lower() == "yes"):
  input("Enter the name of the player to add to the team: ")
# If the user answers "No", print out the team 'roster'

2 Answers

Steven Parker
Steven Parker
200,785 Points

The "if" allows you to add only one player to the team.

The "while" loop allows you to keep adding as many players as you need to fill the whole team.

Thank you. This makes sense. I was wondering the same thing.