Clone a List Python Programming

Problem:- The Code tab has code that attempts to add a clone of a list to itself. There is no error message, but the results are not as intended. Can you fix the code?

Examples:-

clone([1, 1]) ➞ [1, 1, [1, 1]]

clone([1, 2, 3]) ➞ [1, 2, 3, [1, 2, 3]]

clone(["x", "y"]) ➞ ["x", "y", ["x", "y"]]

Code:-



Problem code.


Answer code.

Note:- Never miss indentation. If you are stuck check the python documentation. Suggestions and comments are always welcome.







Comments

Popular posts from this blog

Moving to the End Python Programming

Alphabet Soup Python Programming

Characters in Shapes Python Programming