0

I want the input to be like

2 3 4 5

and not like

2
3
4
5

Is there any way to do it by adding end='' or some other way in the input() function?

This is part of a recursive function called makearray(). I want it to take spaced inputs and not on new lines.

l = int(float(input("Enter number in array 1:"end='')))  
if (l > 0):
    global p
    p = np.append(p, l * l)
else:
    pass
makearray(b - 1)
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
nik
  • 1
  • 1
  • I don't quite understand your problem. Try the following `l = list(map(int, input("Enter the values with spaces between them: ").split()))`. It will create the list of entered values – gremur Mar 28 '22 at 16:16
  • 2
    "I want the input to be 2 3 4 5 and not 2 3 4 5" What do you mean? Can you give more details about what do you want, please? – TKirishima Mar 28 '22 at 17:33
  • Please provide enough code so others can better understand or reproduce the problem. – Community Mar 29 '22 at 02:04

0 Answers0