๐Ÿ“„ Python

6. ๋ฆฌ์ŠคํŠธ ํŠœํ”Œ ๋”•์…”๋„ˆ๋ฆฌ

sa1t 2022. 6. 9. 10:41
๋ฐ˜์‘ํ˜•
##### ๋ฆฌ์ŠคํŠธ #####
# ์—ฌ๋Ÿฌ๊ฐœ์˜ ๋ณ€์ˆ˜๋ฅผ ํ•˜๋‚˜๋กœ ๋ฌถ์–ด์ค€๊ฒƒ
# ๋‹จ๋…์œผ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ๋ณด๋‹ค for, while ๊ณผ ํ•จ๊ป˜ ์‘์šฉํ•ด์„œ ์‚ฌ์šฉํ•œ๋‹ค
# ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ• ๋•Œ์™€ ์‚ฌ์šฉ๋ฒ•์ด ๋™์ผํ•˜๋‹ค
# ๋ฆฌ์ŠคํŠธ ๋ช… ๊ทœ์น™๋„ ๋ณ€์ˆ˜์™€ ๋™์ผ

# ์ž๋ฐ” c์–ธ์–ด ๊ณ„์—ด => ๋ฐฐ์—ด array
# ๋ฆฌ์ŠคํŠธ ํ•ญ๋ชฉ ๊ฐ’์ด ์—ฌ๋Ÿฌ๊ฐœ์˜ ๋ฐ์ดํ„ฐ ํ˜•์‹ ์ƒ๊ด€ ์—†์Œ

a= 10
print(a)

a = [1,2,3,4,5,6,7,8,9]
print(a)

# ๋ณ€์ˆ˜ ์‚ฌ์šฉ vs ๋ฆฌ์ŠคํŠธ ์ฒจ์ž ์‚ฌ์šฉ
a,b,c,d,=0,0,0,0
sum = 0

a = int(input("1๋ฒˆ์งธ ์ˆซ์ž : "))
b = int(input("2๋ฒˆ์งธ ์ˆซ์ž : "))
c = int(input("3๋ฒˆ์งธ ์ˆซ์ž : "))
d = int(input("4๋ฒˆ์งธ ์ˆซ์ž : "))

sum = a+b+c+d
print(sum)


# 2. ๋ฆฌ์ŠคํŠธ ์ฒจ์ž ์‚ฌ์šฉ
aa = [0,0,0,0]
sum = 0

aa[0] = int(input("1๋ฒˆ์งธ ์ˆซ์ž : "))
aa[1] = int(input("2๋ฒˆ์งธ ์ˆซ์ž : "))
aa[2] = int(input("3๋ฒˆ์งธ ์ˆซ์ž : "))
aa[3] = int(input("4๋ฒˆ์งธ ์ˆซ์ž : "))

sum =aa[0]+aa[1]+aa[2]+aa[3]
print(sum)


## for๋ฌธ ์‘์šฉํ•ด์„œ ํ•ญ๋ชฉ 100๊ฐœ์งœ๋ฆฌ ๋ฆฌ์ŠคํŠธ ์ž…๋ ฅ๋ฐ›๊ธฐ
# ๋น„์–ด์žˆ๋Š” ๋ฆฌ์ŠคํŠธ ๋งŒ๋“ค๊ณ , ๋ฆฌ์ŠคํŠธ์— ํ•ญ๋ชฉ ์ถ”๊ฐ€
# append : ๋ฆฌ์ŠคํŠธ ์š”์†Œ ์ถ”๊ฐ€

aa=[]
aa.append(0)
aa.append(0)
aa.append(0)
aa.append(0)
print(aa)

aa=[]
aa.append(input("์ˆซ์ž๋ฅผ ์ ์–ด์ฃผ์„ธ์š” : "))
aa.append(input("์ˆซ์ž๋ฅผ ์ ์–ด์ฃผ์„ธ์š” : "))
aa.append(input("์ˆซ์ž๋ฅผ ์ ์–ด์ฃผ์„ธ์š” : "))
aa.append(input("์ˆซ์ž๋ฅผ ์ ์–ด์ฃผ์„ธ์š” : "))
print(aa)

# aa[4]=10
# ํ•ญ๋ชฉ์„ ์ถ”๊ฐ€ํ•˜๋ ค๋ฉด ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•ด์•ผํ•œ๋‹ค.

aa=[]
for i in range(0,100):
    aa.append(i)
print(aa)
print(len(aa))
# ๋ฆฌ์ŠคํŠธ์˜ ํ•ญ๋ชฉ ๊ฐœ์ˆ˜, ๋ฌธ์ž์—ด์˜ ๊ธธ์ด

# ์ˆซ์ž 4๊ฐœ ์ž…๋ ฅ ๋ฐ›์•„ ํ•ฉ ๊ตฌํ•˜๊ธฐ
# for๋ฌธ ์‘์šฉ
aa=[]
sum=0
i=0

for i in range(0,4):
    aa.append(0)
    aa[i]=int(input(str(i+1)+ "๋ฒˆ์งธ ์ˆซ์ž : "))
    sum = sum + aa[i]
print(sum)

# Quiz) ๊ฐฏ์ˆ˜๋ฅผ ํ•œ์ • x , q ๋ˆ„๋ฅผ๋•Œ ๊นŒ์ง€ ๊ณ„์† ๋”ํ•˜๊ธฐ
# while ๋ฌธ

aa=[]
sum=0
i=0
while True:
    aa.append(int(input("%d๋ฒˆ์งธ ์ˆซ์ž๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š” : " %i)))
    if aa[i]==0:
        print("์ค‘์ง€๋˜์—ˆ์Šต๋‹ˆ๋‹ค")
        break
    sum=sum+aa[i]
    i=i+1
    print(sum)


# ๋ฆฌ์ŠคํŠธ ์ƒ์„ฑ๊ณผ ์ดˆ๊ธฐํ™”
aa=[]           # ์ดˆ๊ธฐํ™”
bb=[10,20,30]   # ์ •์ˆ˜ ์‚ฌ์šฉ
cc=['ํŒŒ์ด์ฌ','๊ตฟ'] # ๋ฌธ์ž์—ด ์‚ฌ์šฉ
dd=[10,20,'ํŒŒ์ด์ฌ'] # ์ •์ˆ˜, ๋ฌธ์ž์—ด ํ˜ผํ•ฉ ๊ฐ€๋Šฅ

# ๋ฆฌ์ŠคํŠธ ์ƒ์„ฑ ํ›„ ์ฒจ์ž๋ฅผ ํ†ตํ•ด ํ•ญ๋ชฉ๊ฐ’์— ์ ‘๊ทผ
# ์ž๋ฆฌ๊ฐ’์„ ์˜๋ฏธํ•˜๋Š” ์ฒจ์ž๋Š” ์–‘์ˆ˜,์Œ์ˆ˜ ๋‘˜๋‹ค ์‚ฌ์šฉ ๊ฐ€๋Šฅ
# ์–‘์ˆ˜ 0์ด ์™ผ์ชฝ ์ฒซ๋ฒˆ์งธ ํ•ญ๋ชฉ
# ์Œ์ˆ˜ -1์ด ์˜ค๋ฅธ์ชฝ ์ฒซ๋ฒˆ์žฌ ํ•ญ๋ชฉ

a = [1,2,3,4,5,6,7,8,9]
print(a[0])
print(a[1])
# ์˜ค๋ฅธ์ชฝ ๋ถ€ํ„ฐ
print(a[-1])
print(a[-2])
# ์™ผ์ชฝ ๋ถ€ํ„ฐ

# ์ฒจ์ž์— ์ฝœ๋ก  ์‚ฌ์šฉ (๋ฒ”์œ„ ์ง€์ •)
# aa=[์‹œ์ž‘๊ฐ’:๋๊ฐ’+1]
print(a[0:3])
print(a[2:4])

# ์‹œ์ž‘๊ฐ’ , ๋๊ฐ’ ์•ˆ์“ฐ๋ฉด
print(a[:3])
print(a[3:])

# Quiz) for , while ์„ ํƒ 1~100 3์˜ ๋ฐฐ์ˆ˜๋ฅผ ๋ฆฌ์ŠคํŠธ์— ๋„ฃ์ž => list1
# list1(3~99) // list2(99~3)
# for i in range(0,len(list1)+1,1)

a=[]
b=[]
i=1
while i<101:
    if i%3==0:
        a.append(i)
    i = i + 1

for i in range(0,len(a),1):
    b.append(0)
    b[i] = a[len(a)-i-1]

print(a)
print(b)

# Quiz) 3,6,9 ๊ฒŒ์ž„
# 1~100๊นŒ์ง€

for i in range(1, 101):

    a = str(i)
    count = 0
    for x in a:
        if (x == '3') or (x == '6') or (x == '9'):
            count= count+ 1
    if count == 0:
        print(i)
    else:
        print(a +' ('+count*'์ง'+')')




### ๋ฆฌ์ŠคํŠธ์˜ ์—ฐ์‚ฐ

aa=["์•ˆ","๋…•","ํ˜œ"]
bb=["๋ผ","๊ฐ€","๋‹ค","๊น€?"]
print(aa+bb)
print(aa*3)

### ๋ฆฌ์ŠคํŠธ ํ•ญ๋ชฉ ์•ˆ์˜ ๊ฐ’์„ ๋ฐ”๊พธ๊ธฐ
aa=["์•ˆ","๋…•","ํ˜œ"]
aa[0]="์ด"
print(aa)

aa[0:2]="๊น€","๋ผ"
print(aa)

# ๋ฆฌ์ŠคํŠธ ์•ˆ์— ๋ฆฌ์ŠคํŠธ ( ์ค‘์ฒฉ ๋ฆฌ์ŠคํŠธ )
# ๋ฆฌ์ŠคํŠธ => ์ฒจ์ž ( ์ž๋ฆฟ๊ฐ’ ) => ๋ณ€์ˆ˜์™€ ๋น„์Šท
# ๋ณ€์ˆ˜ => ๋ฆฌ์ŠคํŠธ
a[0] = [2,1,3,4,54,2,2]
aa=[10,20,30,40]
aa[1]=[15,20,25]
print(aa)

# ๋ฆฌ์ŠคํŠธ ์•ˆ์— ํ•ญ๋ชฉ๊ฐ’ ์‚ญ์ œ
del(aa[1])
print(aa)

del(aa[0:2])
print(aa)


################### ๋ฆฌ์ŠคํŠธ ๊ด€๋ จ ํ•จ์ˆ˜ ###################

list = [10,30,40,20]
print(list)

list.append(50)
print(list)

list.pop()
print(list)
# pop ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰ ํ•ญ๋ชฉ ์‚ญ์ œ

list.sort()
print(list)
# sort : ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌ

list.reverse()
print(list)
# reverse : ๋ฆฌ์ŠคํŠธ๋ฅผ ์—ญ์ˆœ์œผ๋กœ ๋ณ€๊ฒฝ

print(list.index(20))
# ํ•ด๋‹น ๊ฐ’์ด ์ฒจ์ž ์ž๋ฆฌ๊ฐ’์œผ๋กœ ์ถœ๋ ฅ

list.insert(2,22222)
print(list)
# ๋ฆฌ์ŠคํŠธ ์ค‘๊ฐ„ ์ง€์ •๋œ ์ž๋ฆฌ ๊ฐ’์— ํ•ญ๋ชฉ ์ถ”๊ฐ€

list.remove(22222)
print(list)
# ํ•ญ๋ชฉ ๊ฐ’์„ ๋ฆฌ์ŠคํŠธ์—์„œ ์‚ญ์ œ

list.extend([55,555,555,55])
print(list)
# ๋ฆฌ์ŠคํŠธ ํ™•์žฅ

print(list.count(55))

# Quiz) ๋ฆฌ์ŠคํŠธ 10๊ฐœ ํ•ญ๋ชฉ ์ž์œ ๋กญ๊ฒŒ ๋งŒ๋“ค๊ธฐ
# ์ž…๋ ฅ 1 ) index๋กœ ์ž๋ฆฌ ๊ฒ€์ƒ‰
# ์ž…๋ ฅ 2 ) insert๋กœ ํ•ญ๋ชฉ ์ž…๋ ฅ
# ์ž…๋ ฅ 3 ) countํ•  ํ•ญ๋ชฉ ๊ฐ’ ์ž…๋ ฅ
# if๋ฌธ์œผ๋กœ ๋งŒ๋“ค๊ธฐ

๊ณผ์ผ = ["๊ทค", "์˜ค๋ Œ์ง€", "๋”ธ๊ธฐ", "ํฌ๋„", "์˜ค๋ Œ์ง€", "์˜ค๋ Œ์ง€", "์„๋ฅ˜", "ํ‚ค์œ„", "๋ฐฐ", "๋ฐ”๋‚˜๋‚˜"]
if ๊ณผ์ผ>["๊ทค"]:
    ๊ณผ์ผ.insert(3,"๋”ธ๊ธฐ")
    print(๊ณผ์ผ.index("ํฌ๋„"))
    print(๊ณผ์ผ.count("๋”ธ๊ธฐ"))
print(๊ณผ์ผ)


# ์ค‘์ฒฉ ๋ฆฌ์ŠคํŠธ x ์ค‘์ฒฉ for ๋ฌธ
list1=[]
list2=[]
value=1

for i in range(0,3):
    for k in range(0,4):
        list1.append(value) # ์ž‘์€ for๋ฌธ์— 4์ž๋ฆฌ์”ฉ 1์ฆ๊ฐ€
        value = value + 1
    list2.append(list1)     # ํฐ for๋ฌธ์— 3์ž๋ฆฌ
    list1=[]                # ์ดˆ๊ธฐํ™”

for i in range(0,3):
    for k in range(0,4):
        print("%3d" %list2[i][k], end='') # ํ–‰ ๋„˜๊ธฐ์ง€ ์•Š๊ณ  ๋„์–ด์“ฐ๊ธฐ
    print(" ") # ํ–‰ ๋„˜๊ธฐ๊ธฐ

####################################### ํŠœํ”Œ #######################################
# ๋ฆฌ์ŠคํŠธ = []
# ํŠœํ”Œ = ()
# ํŠœํ”Œ ๊ฐ’์„ ์ˆ˜์ •ํ•˜๊ธฐ ํž˜๋“ค์–ด ์ฝ๊ธฐ ์ „์šฉ์œผ๋กœ ์‚ฌ์šฉํ•œ๋‹ค
# ์„ฑ๋ณ„ = ( ๋‚จ์„ฑ ,์—ฌ์„ฑ ) , ์„œ์šธ์‹œ ๊ตฌ ๋ชฉ๋ก = (๊ฐ•๋‚จ๊ตฌ, ๊ตฌ๋กœ๊ตฌ, ๋…ธ์›๊ตฌ...), ๋‚˜๋ผ ์ด๋ฆ„ = ( ๋Œ€ํ•œ๋ฏผ๊ตญ,๋ถํ•œ... )

tt1 = (10,20,30)
print(tt1)

tt2= 10,20,30
print(tt2)
# ๋ณ€์ˆ˜์— ์—ฌ๋Ÿฌ๊ฐœ์˜ ๊ฐ’์„ ๋„ฃ์œผ๋ฉด ์ž๋™์œผ๋กœ ํŠœํ”Œ ์ƒ์„ฑ

tt3=10,
tt4=(10,)
print(tt3)
print(tt4)
# ๊ฐ’์ด ํ•˜๋‚˜์ธ ํŠœํ”Œ ์ƒ์„ฑํ•  ๋•Œ (๊ฐ’,) ์ฝค๋งˆ ์ถ”๊ฐ€

tt5 = (10)
print(tt5)

tt1.append(40)
# ํŠœํ”Œ์€ ์ฝ๊ธฐ ์ „์šฉ์ด๊ธฐ ๋•Œ๋ฌธ์— ํ•ญ๋ชฉ ๊ฐ’ ์ถ”๊ฐ€, ์‚ญ์ œ, ์ˆ˜์ •์ด ๋ถˆ๊ฐ€๋Šฅ

tt1=(10,20,30,40)
print(tt1[0])
# ์ฒจ์ž, ์ž๋ฆฌ๊ฐ’ ์‚ฌ์šฉ๋ฒ•์€ ๋ฆฌ์ŠคํŠธ์™€ ๋™์ผ


print(tt1[0]+tt1[3])
tt2=("A","B")
print(tt2[0]+tt2[1])
print(tt2[0]*3)
# ๋ฆฌ์ŠคํŠธ ์ฒ˜๋Ÿผ ์—ฐ์‚ฐ ๊ฐ€๋Šฅ

tuple1= (10,20,30)
print(tuple1)

list1=list(tuple1)
print(list1)
list1.append(40)
print(list1)

tuple1=tuple(list1)
print(tuple1)



# Quiz) ๊ณ ๊ฐ ์ •๋ณด ํŠœํ”Œ ๋งŒ๋“ค๊ธฐ
# ([ํšŒ์›๋ฒˆํ˜ธ, ์ด๋ฆ„, ์„ฑ๋ณ„, ์ „ํ™”๋ฒˆํ˜ธ],[ํšŒ์›๋ฒˆํ˜ธ, ์ด๋ฆ„, ์„ฑ๋ณ„, ์ „ํ™”๋ฒˆํ˜ธ],[ํšŒ์›๋ฒˆํ˜ธ, ์ด๋ฆ„, ์„ฑ๋ณ„, ์ „ํ™”๋ฒˆํ˜ธ])
# ๊ธฐ๋Šฅ : ํšŒ์› ๊ฐ€์ž…, ํšŒ์› ์ •๋ณด ์ˆ˜์ •, ํšŒ์› ์‚ญ์ œ
# while๋ฌธ์œผ๋กœ q์ž…๋ ฅ ๋ฐ›์„๋•Œ๋งŒ ๊บผ์ง€๋„๋ก
# ํšŒ์› ์ •๋ณด๋Š” 5์ž๋ฆฌ ํ™•๋ณด ํ›„ 1์”ฉ ์ž๋™ ์ฆ๊ฐ€


b2=[]
i=0

while True :
    ch = str(input(" ๊ธฐ๋Šฅ์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š” ( ํšŒ์›๊ฐ€์ž…, ์ •๋ณด์ˆ˜์ •, ํšŒ์›ํƒˆํ‡ด ) : "))
    if ch == str("q"):
        print(" ์ข…๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค ")
        break

    elif ch=='ํšŒ์›๊ฐ€์ž…' :
        i=i+1
        name = str(input(" ์ด๋ฆ„์„ ์ž…๋ ฅํ•˜์„ธ์š” : "))
        sex = str(input(" ์„ฑ๋ณ„์„ ์ž…๋ ฅํ•˜์„ธ์š” : "))
        phone = input(" ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š” : ")
        cust=("%05d" %i , name,sex,phone)
        b=list(cust)
        b2.append(b)
        print(b2)

    elif ch=='์ •๋ณด์ˆ˜์ •':
        print(" ํšŒ์› ์ •๋ณด ๋ชฉ๋ก : ",b2)
        sch=input(" ์ˆ˜์ •ํ•  ํšŒ์› ์ด๋ฆ„ : ")

        for k in range(0,len(b2)):
            if b2[k][1]==sch:
                ed=input("์ˆ˜์ •ํ•  ์ •๋ณด [ ์ด๋ฆ„, ์„ฑ๋ณ„, ๋ฒˆํ˜ธ ] ์„ ํƒ : ")
                if ed=="์ด๋ฆ„":
                    b2[k][1]=input(" ๋ณ€๊ฒฝ ํ•  ์ด๋ฆ„ : ")
                elif ed=="์„ฑ๋ณ„":
                    b2[k][2]=input(" ๋ณ€๊ฒฝ ํ•  ์„ฑ๋ณ„ : ")
                elif ed=="๋ฒˆํ˜ธ" :
                    b2[k][3]=input(" ๋ณ€๊ฒฝ ํ•  ๋ฒˆํ˜ธ : ")
        print(b2)
    elif ch=='ํšŒ์›ํƒˆํ‡ด' :
        print(" ํšŒ์› ์ •๋ณด ๋ชฉ๋ก : ", b2)
        sch = input(" ํƒˆํ‡ดํ•  ํšŒ์› ์ด๋ฆ„ : ")

        for k in range(0,len(b2)):
            if b2[k][1]==sch:
                b2.remove(b2[k])
                print(" ํƒˆํ‡ด ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ")
        print(b2)

    else:
        print("์œ ํšจํ•œ ๊ธฐ๋Šฅ์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”")





######################### ๋”•์…”๋„ˆ๋ฆฌ #########################
# ๋”•์…”๋„ˆ๋ฆฌ : ์‚ฌ์ „
# ํ‚ค, ๊ฐ’์„ ์ž…๋ ฅํ•˜๊ณ , ๋Œ€์‘๋˜๋Š” ๊ฒƒ์„ ์ถœ๋ ฅํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค
# ๋”•์…”๋„ˆ๋ฆฌ : {ํ‚ค1:๊ฐ’2, ํ‚ค2:๊ฐ’2, ํ‚ค3:๊ฐ’3}

dic={1:"a",2:"b",3:"c"}
print(dic)
print(dic[1])

student1 ={"ํ•™๋ฒˆ":102020,"์ด๋ฆ„":"๋ฏผ๋ณ‘์šฑ","ํ•™๊ณผ":"์ปด๊ณต"}
print(student1)
# ๋”•์…”๋„ˆ๋ฆฌ ์ƒ์„ฑ

student1["์—ฐ๋ฝ์ฒ˜"]= None
print(student1)
# ํ‚ค:๊ฐ’ ์ถ”๊ฐ€

student1["ํ•™๊ณผ"]="์‹ค๊ฑด๋””"
print(student1)
# ๊ฐ’ ์ˆ˜์ •

# ๋”•์…”๋„ˆ๋ฆฌ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ํ•จ์ˆ˜

student1.get('์ฃผ์†Œ')
# ํ‚ค๋กœ ๊ฒ€์ƒ‰, ๊ฐ’ ์ถœ๋ ฅ
print(student1["์ฃผ์†Œ"])
# ํ‚ค ๊ฐ’์ด ์—†์„ ๋•Œ ํ•จ์ˆ˜ ์‚ฌ์šฉ์‹œ null, print : ์—๋Ÿฌ

del(student1["์—ฐ๋ฝ์ฒ˜"])
print(student1)

print(student1.keys())
print(list(student1.keys())) # key๋ฅผ ๋ฆฌ์ŠคํŠธ ํ˜•ํƒœ๋กœ ์ถœ๋ ฅ

print(student1.values())
print((list(student1.values()))) # value๋ฅผ ๋ฆฌ์ŠคํŠธ ํ˜•ํƒœ๋กœ ์ถœ๋ ฅ

print(student1.items()) # tuple ํ˜•ํƒœ๋กœ ์ถœ๋ ฅ
print((tuple(student1)))

print("์ด๋ฆ„"in student1) # ์ด๋ฆ„์ด student1์— ์žˆ๋Š”์ง€ ์—†๋Š”์ง€ ํ™•์ธ
print("์ฃผ์†Œ"in student1) # ์ฃผ์†Œ๊ฐ€ student1์— ์žˆ๋Š”์ง€ ์—†๋Š”์ง€ ํ™•์ธ
# ํ‚ค ๊ธฐ์ค€์œผ๋กœ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๋ฅผ ๋ถˆ๋Œ€์ˆ˜๋กœ ์ถœ๋ ฅ



##### ์Œ์‹ ๊ถํ•ฉ ์ฒดํฌ ######
foods={'๋–ก๋ณถ์ด':'์–ด๋ฌต','ํ”ผ์ž':'ํŒŒ์Šคํƒ€','๋ผ๋ฉด':'๊น€์น˜','์น˜ํ‚จ':'๋งฅ์ฃผ',
       '์‚ผ๊ฒน์‚ด':'์†Œ์ฃผ'}

while True:
    myfood = input(str(list(foods.keys()))+ " ์ค‘ ์Œ์‹์„ ๊ณ ๋ฅด์„ธ์š” ")
    if myfood in foods :
        print("%s์™€ ๊ถํ•ฉ์ด ์ข‹์€ ์Œ์‹์€ %s์ž…๋‹ˆ๋‹ค" %(myfood,foods.get(myfood)))
    elif myfood =="๋":
        print("์ข…๋ฃŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค")
        break
    else:
        print("๋ชฉ๋ก์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”")
๋ฐ˜์‘ํ˜•