i = 2
for element in a:
if element == 'y':
pass
i = 3
else:
print(element+str(i))
p2
t3
h3
o3
n3
a = 'pythyon'
i = 2
for element in a:
if element == 'y':
continue
i = 3
else:
print(element+str(i))
p2
t2
h2
o2
n2
continue表示跳过后面的程序,重新循环,而pass表示站位,后面的代码(else之前)还是会执行,