Q. Let nums2 and nums3 be two non-empty lists. Write a Python command that will append the last element of nums3 to the end of nums2.

Answer :- 

nums2.append(nums3[ -1 ])

Explanation :-

nums3[ -1 ] return last element of lis nums3.

nums2.append(nums3[ -1 ]) will append last element of nums3 to nums2.  



2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Can u explain it properly please

    ReplyDelete
    Replies
    1. Explanation :-

      nums3[ -1 ] return last element of lis nums3.

      nums2.append(nums3[ -1 ]) will append last element of nums3 to nums2.

      Delete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post