0

I don't understand this one.

nums=[1,2,3,4,5]nums [3]=nums [1]print (nums [3])how the answer could be 2?

8th Jul 2016, 2:24 AM
pragati das
pragati das - avatar
9 Answers
+ 4
Because with "nums [3]=nums [1]" you make the third number ( which, as we know, it's actually the forth since you have to start counting from 0, not 1) , in this case 4, turn into the first number (actually the second) , which is 2.
8th Jul 2016, 3:23 AM
AgustĆ­n
+ 2
after executing nums[3] =nums[1], the list is changed to [1,2,3,2,5]. since index starts from 0.
8th Jul 2016, 4:42 AM
Subhankar Paul
Subhankar Paul - avatar
+ 2
list 3 index means 4 th position in list and 1 index means 2 position. now compare ...
8th Jul 2016, 3:27 PM
Shantam Vijayputra
Shantam Vijayputra - avatar
+ 1
List index 3 has value of 4 and is replaced by value of index 1 which is 2. Now position 3 has value of 2, copied from index 1. Hope you understood it.
8th Jul 2016, 3:19 AM
Abdullahi Yusuf
Abdullahi Yusuf - avatar
+ 1
Cuz nums[0]=1,nums[1]=2,nums[2]=3,nums[3]=4,nums[4]=5.
8th Jul 2016, 7:58 AM
xuezhiyuan
0
Š–Š°Š»ŠŗŠ¾ чтŠ¾ ŠŗŠ¾Š¼Š¼ŠµŠ½Ń‚Š°Ń€ŠøŠø Š½ŠµŃ‚ Š½Š° руссŠŗŠ¾Š¼
9th Jul 2016, 4:08 PM
Minecrafter PE
Minecrafter PE - avatar
0
because when u do this nums [3]=nums [1] .... the num [3] value will over write and num [3] shows the value of num[1]
25th Jul 2016, 7:00 PM
Armaghan Khan
Armaghan Khan - avatar
0
You replaced the 4 with a 2, but the 2 itself remained unchanged.
28th Jul 2016, 2:04 PM
Ryan ā€œthe Jenksā€ Jenkins
Ryan ā€œthe Jenksā€ Jenkins - avatar
- 2
Test it out.
8th Jul 2016, 4:40 AM
sophie
sophie - avatar