카테고리 없음

파이썬 딕셔너리

비즈봉 2019. 4. 18. 21:31
cnt=1
volume=1000

for x in range(1,1000):
    cnt = cnt * 2
#    print('after',x,'days,cnt=',cnt)
    if(cnt>=1000):
        break

print('after ',x,'days, cnt exeeds',volume)

mydiction = ['boy','girl','school','score','bag','teach']

print(mydiction)
print('mydiction[0]=',mydiction[0])
# 이 변수가 몇개의 원소를 가지고 있는가 => length

length=len(mydiction)
print('length of mydiction=',length)

for x in mydiction:
    print(x)

for y in range(0,6):
    print(mydiction[y])
#best
myleng=len(mydiction)
for z in range(0,myleng):
    print(mydiction[z])

#이 단어가 내 사전에 저장되어있는지를 체크해주세요
#거리라는 단어는 몇번째 단어인가요
#딕셔너리


word = "mountain"
print (word[0])
print (word[1])



#hword="dog"

#print(hword[0])