What is the result of this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

What is the result of this code?

nums = [1, 2, 3, 4, 5] nums[3] = nums[1] print(nums[3])

31st Oct 2020, 10:01 AM
Petra
1 Answer
+ 4
#This is the simplified one, run this and try to understand. nums = [1, 2, 3, 4, 5] print("value of fourth position= ", nums[3]) print("value of second position= ",nums[1]) print("replacing fourth value with second one") nums[3] = nums[1] print("now value of fourth position= ", nums[3])
31st Oct 2020, 10:16 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar