i-Gagan i-Gagan - 3 years ago 128
Python Question

taking multiple line input in python without using list comprehensions?


without knowing the 'size' how to take multi-line input and store it in a list ?


1
2
3
4

> list=[]
> size=int(input())
> for i in range(size):
> list.append(int(input()))

Answer Source
result = []
while True:
    item = input()
    if not item:
        break
    result.append(int(item))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download