I just have a basic question about a for loop
in Python 3. It's a stupid, simple question, but I figure everyone else here is far more knowledgeable to me, and most answers are pretty bright! I do not profess to be intelligent, so I'd like some clarification. Running this loop seems to add a value of only one. I have defined x
to be 1
, so this makes sense, but I didn't give i
a true value and it seems to just naturally be 1
.
for i in range(0, 50):
x = 1
i = x + i
print(i)
I'm not getting an error, I'm just curious as to what's going on behind the scenes. Would love some explanation from someone who understands this more than I do!