Reputation: 173
I am new to Python so please explain any code you write!
I want an input()
to terminate after 1 blank line to allow for more than one line.
For example, if I press Enter while using input()
, I want it to go onto the next line, but if I press Enter again, it returns out of the program.
Upvotes: 0
Views: 1367
Reputation: 14360
Try this:
quit = False
while not quit:
d = input()
print(d)
if d == '': quit = True
or
while True:
d = input()
if d == '': break
print(d)
Upvotes: 1