Reputation: 113
This is the code I'm referring to the above question,
my_list = [1, 2, 3, 4, 5]
if(another_list == my_list[2:]):
print("good")
else:
print("bad")
In the code sample above, is my_list[2:] stored in the memory (like we assigned it to a variable)? Or is it forgotten after the conditional is over?
Upvotes: 0
Views: 204
Reputation: 98
You didn't assign it to a variable so it isn't stored. It is forgotten after the conditional but it will always work when the program is run again if the program is more or less the same.
Upvotes: 1