Shubham - 1 year ago 59

Python Question

I am new to python language.

I dont know how to take input in different lines in python??

So i would like to take n number of inputs like this using loop:

`4 #first line input`

3 2 #second line input

5 3 6 #third line input

1 2 3 4 #fouth line input

# and so on....

n lines will contain n input.

Answer Source

I suppose the first line is your number of lines, i.e, your `n`

.

So you can do it like this :

```
for i in range(int(input())):
line = input()
#process your input
```

else you can do it like :

```
n = #your number of lines
for i in range(n):
line = input()
#process your input
```