79388331

Date: 2025-01-26 10:05:52
Score: 1.5
Natty:
Report link

You can't reference list's variable location in memory through the variables it was created from. Consider this example:

a = 1; b = 2; c = 3
l = [a, b, c]
a = 5
print(a, b, c, str(l)) # Will print "5 2 3 [1, 2, 3]"

Once you modify variable a, element l[0] will point to a different location in memory. Check out this article to learn more about how memory works in python.

Reasons:
  • Blacklisted phrase (1): this article
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: CodingTea