How can I press enter to exit. And if no input to prompt the "There must be at least one player!" message? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I press enter to exit. And if no input to prompt the "There must be at least one player!" message?

print("Player name or <ENTER> to end:", end="") if(players == 0): player1 = input() if(player1 == ""): print("There must be at least one player!") if(player1 == ""): exit() else: players += 1

2nd Sep 2020, 8:03 AM
SWL
1 Answer
0
It's impossible, to read input you must press enter. And if you already have another idea for blank input. How would you exit by enter?
7th Sep 2020, 11:29 AM
你知道規則,我也是
你知道規則,我也是 - avatar