0
list functions
What is the result of this code? nums = [9, 8, 7, 6, 5] nums.append(4) nums.insert(2, 11) print(len(nums)) How the output get as 7?
1 ответ
0
Hi PRIYANKA K you can print nums after every operation to see how it has changed.
https://code.sololearn.com/cSqpD1p9T4yQ/?ref=app
The append functions adds 4 to the end of the list. The insert function inserts 11 at 2nd index. The value at index 2 is not replaced but shifted to right side.