arr = map(int, input().split())
for i in arr:
print(i)
print(list(arr)[1])
When I run this code and give the input as,
1 2 3 4 5
it gives the output as follows,
1
2
3
4
5
Traceback (most recent call last):
File "/home/muyustan/PycharmProjects/openCV/split.py", line 6, in <module>
print(list(arr)[1])
IndexError: list index out of range
Then,
arr = map(int, input().split())
# for i in arr:
# print(i)
print(list(arr)[1])
after commenting out the for loop and running the program and providing the same input, it gives the output at the terminal as follows;
2
Why using that for loop makes any changes?