input.py
n = 5
for i in range(n):
print(i)
output.py
0
1
2
3
4
input.py
x = 1
y = 4
for i in range(x,y):
print(i)
output.py
1
2
3
input.py
for char in 'string':
print(char)
output.py
s
t
r
i
n
g
input.py
list = ['a','b','c']
for a in list:
print(a)
output.py
a
b
c
input.py
dict = {'key1':'val1', 'key2':'val2'}
for k,v in dict.items():
print(k,v)
output.py
key1 val1
key2 val2
input.py
for key in dict:
print(key)
output.py
key1
key2
Recommended Posts