In [29]:
animals = ["cat", "cow", "dog", "bull"]
my_information = {"name" : "JY", "phone_num" : "010-9354", "email" : "jiyong"}
In [7]:
for i in animals:
print i
In [27]:
for my_information in my_information.items():
key, value = my_information #대입 연산자
print key
print value
In [30]:
for key, value in my_information.items():
print key
print value
In [80]:
friends = ["jy","jd","ey","hy"]
In [53]:
for i in range(len(friends)):
if i == 2:
friends[i] = "Gd"
print(friends[i])
In [71]:
friends.index("jy")
Out[71]:
In [81]:
for i in friends:
index = friends.index(i)
if index == 3:
friends[index] = "GD"
print friends[index]
In [82]:
for i in enumerate(friends):
print i
In [78]:
for index, value in enumerate(friends):
if index == 3:
friends[index] = "GD"
print friends[index]