1

I wrote this code in Python3:

for _ in range(2):
    inputs = input()
    print(inputs)

It works fine when I provide the input values one by one. It also works when the input values are copied and pasted as in Image 1 and the Image 2 is printed in the terminal.

However, when the input is copied and pasted as in Image 3, it just doesn't print the last line and expects the user to press enter (or to add more characters and then press enter) to finish the code: Image 4

What is going on?

Why is this happening and how can I solve it when some other program or a user gives the input that way?

1 Answers1

0

image

There is no new line after the second input please provide new line (by hitting enter) .

After insert 1 10 there is no new line and input method is waiting for user to provide a new line so it will stop reading and return string as output.

Udesh
  • 2,415
  • 2
  • 22
  • 32