This comment is hidden because it contains spoiler information about the solution
Why is creating a new object successful for this Kata whereas if chars[index] = chars[index].upper() is used all outputs are Uppercase?
Here's a quick breakdown comparing:
x = y
x = y[:]
x = y.copy()
https://www.programiz.com/python-programming/methods/list/copy
yes, [:] creates a new object
[:]
Yes, the last is another reference to the same list, not a copy at all.
def dot_product(a, b): for d in dir(a): print(d) # code return -1
Loading collection data...
This comment is hidden because it contains spoiler information about the solution
Why is creating a new object successful for this Kata whereas if chars[index] = chars[index].upper() is used all outputs are Uppercase?
Here's a quick breakdown comparing:
x = y
x = y[:]
x = y.copy()
https://www.programiz.com/python-programming/methods/list/copy
yes,
[:]
creates a new objectYes, the last is another reference to the same list, not a copy at all.