i want to take integer input in an array ,and the integer input should be space separated…
how can i do it…
you can use something like map function to do it:
array = map(int, input().split())
Hope it helps :).
thanx,but it is not helping…
i am using this
for i in range (0,10):
c[i]=int(input(""))
it needs to press ENTER,but i want SPACE to input integer
Try this approach.
l=input() #Accept everything in a string variable with spaces as you like
la=l.split(' ') #the list la will contain all numbers separately as a string
l=[]
for i in la:
i=int(i)
l.append(i)
print(l) #This will print l which has integer elements