Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
When I am trying to append data, it gives list index out of range error.
n = int(input('Enter Range')) arr=[] for i in range(0,n): print(i) arr[i].append(input('Enter Number')) arr.sort() print(arr)
arr[i].append
arr.append
arr.append() function will append element to the end of the list
n = int(input('Enter Range')) arr=[] for i in range(0,n): print(i) arr.append(input('Enter Number')) # Modify this line arr.sort() print(arr)
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
arr[i].appendshould bearr.append