0
Can anyone help me ?
Input Format The first line contains an integer, N (the size of our array). The second line contains N space-separated integers describing array 's A elements. How to I get a space seperated input from user?
5 Answers
+ 2
Ramya Thiurmalisamy
For example array size =5
And then if you input "1 2 3 4 5" as a string ,split will turn them into list with seperated numbers ,
+ 2
store the user input in variable 'inp'
split user input at spaces
print the resulting list
+ 2
be aware that split produce a list of string, even if there are only digits... you need to cast them to int ^^
+ 1
inp = input(">>> ")
inp = inp.split(" ")
print(inp)
0
visph can you please explain it?



