x=5
y=x
x=7
# Changing the value of x does not effect the value of y
As a simple example both x
&y
have different memory location so changing one does not effect other
But in the code below next(y)
is giving 4
why?
According to my logic it must be 1
where I am going wrong
a=[1,2,3,4,5,6,7,8,9,10]
x=iter(a)
y=x
print(next(x))
print(next(x))
print(next(x))
print(next(y))