I came across code like this:
s1 = "mit u rock"
s2 = "i rule mit"
if len(s1) == len(s2):
for char1 in s1:
for char2 in s2:
if char1 == char2:
print("common letter")
break
I notice there are no previous defines for the variable like char1
or char2
, so how does this work? I think it might be some "keyword for a variable" that Python understands. If so, could you tell me what's it called, and what are other common variables like this?