Before you report me for duplicate let me link similar topics which say how to write the code, but don't say how it works:
- How do I read multiple lines of raw input in Python?
- How to get multiline input from user [duplicate]
Now the code to read multiple lines:
'''
input data:
line 1
line 2
line 3
'''
line_holder = []
while True:
line = input("\nPlease paste here lines :\n")
if line:
line_holder.append(line)
else:
break
for line in line_holder:
print(line)
How I understand it:
- loop will repeat until "break" statement
- in input we paste multiple lines which are stored in some kind of queue
- if there is anything in the input queue to work with
- add first value from this queue to list
- if there is nothing, kill the loop with "break"
- finally, print what we added from queue input to list
So if there is a queue of inputs, how else can I reach it? How is it stored on the computer and why do I need to build list, to see it?