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 The Challenge

Tucker Fischer
Tucker Fischer
10,517 Points

How to prevent input from printing on the next line in Console.

player_name = []

print(input("Would you like to add a player to the roster? "))

def added_player(): print(input("What is the name of the player? ")) player_name.append(added_player) print player_name

if 'yes': added_player()

In console:

treehouse:~/workspace$ python team.py
Would you like to add a player to the roster? yes
yes <<< I don't want this
What is the name of the player? bob
bob <<< I don't want this

1 Answer

Brandon White
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 Points

Hi Tucker,

If you don't want the user response to print on the next line, then avoid wrapping your input function inside the print function.

If you've written your code in the REPL and not in the file, I'm not sure there's a way to keep the user response from printing on the next line.