- 1

What is the result of this code? nums = [9, 8, 7, 6, 5] nums.append(4) nums.insert(2, 11) print(len(nums))

I need help

5th Dec 2016, 12:11 PM
Alisha Leay
Alisha Leay - avatar
5 ответов
+ 5
length will be 7. nums = [9, 8, 7, 6, 5] nums.append(4) #[9,8,7,6,5,4] nums.insert(2, 11) #[9,8,11,7,6,5,4] print(len(nums))
5th Dec 2016, 12:21 PM
Nagendra Prajwal
Nagendra Prajwal - avatar
+ 2
7
20th Feb 2020, 11:05 AM
JOHN MACHARIA
JOHN MACHARIA - avatar
+ 1
7 is the Ans. nums.append(4) addes a 4 to the end So [9,8,7,6,5,4] whereas nums.insert(2, 11) adds 11 at the second place of the list so [9,8,11,7,6,5,4] so totally 7 is the length
11th May 2020, 6:24 PM
KriShna RaJendra N
KriShna RaJendra N - avatar
+ 1
What is the output of this code? nums = [2,4,8,9,5] nums.insert(1, 3) nums.remove(9) nums.insert(0, nums.count(8)) print(nums[3])
21st Mar 2022, 4:11 PM
Marta
0
4
12th Aug 2022, 7:01 AM
hadi farnia