Computer Science

Consider the following code and predict the result of the following statements.

bieber = ['om', 'nom', 'nom']
counts = [1, 2, 3]
nums = counts
nums.append(4)
  1. counts is nums
  2. counts is add([1, 2], [3, 4])

Python

Python List Manipulation

12 Likes

Answer

  1. Output is True as both nums and counts refer to the same list.
  2. This will cause an error as add function is not defined in the above code.

Answered By

5 Likes


Related Questions