ํ๋ก๊ทธ๋๋ฐ์ ์๋ฃํ
์ ์, ์์, ๋ฌธ์์ด, ๋ถ๋ฆฐ
์ถ์ํ
๋ณต์กํ ๋ด์ฉ์ ์จ๊ธฐ๊ณ ์ฃผ์ ๊ธฐ๋ฅ์๋ง ์ ๊ฒฝ ์ฐ์
ํ๋ก๊ทธ๋๋ฐ์์์ ์ถ์ํ
- ๋ณ์
๊ฐ์ ์ ์ฅํ๋ ๊ฒ
- ํจ์
๋ช ๋ น์ ์ ์ฅํ๋ ๊ฒ
def hello(): # ํจ์์ ํค๋
print("Hello!")
print("Welcome to Suwon")
hello()ํ๋ผ๋ฏธํฐ : ํจ์์ ๋๊ฒจ ์ฃผ๋ ๊ฐ
def hello(name):
print("Hello!")
print(name)
print("Welcome to Suwon")
hello("Chris")์ฌ๋ฌ ๊ฐ์ ํ๋ผ๋ฏธํฐ
def print_sum(a, b, c):
print(a + b + c)
print_sum(7, 3, 2)return : ๋๋ ค์ค๋ค
- ๊ฐ์ฒด
์ ์ํ๊ณผ ์ ์ํ๊ฐ์ ์ฐ์ฐ์ ๋ชจ๋ ์ ์ํ์ผ๋ก ๋์จ๋ค.
# ๋๋จธ์ง
print(7 % 3) # 1
# ๊ฑฐ๋ญ์ ๊ณฑ
print(2**3) # 2์ 3์ ๊ณฑ -> 8์์ํ๊ณผ ์์ํ๊ฐ์ ์ฐ์ฐ์ ๋ชจ๋ ์์ํ์ผ๋ก ๋์จ๋ค.
# ๋๋จธ์ง
print(7.0 % 3.0) # 1.0
# ๊ฑฐ๋ญ์ ๊ณฑ
print(2.0**3.0) # 8.0์์ํ๊ณผ ์ ์ํ๊ฐ์ ์ฐ์ฐ์ ๋ชจ๋ ์์ํ์ผ๋ก ๋์จ๋ค.
# ๋๋จธ์ง
print(7 % 3.0) # 1.0
# ๊ฑฐ๋ญ์ ๊ณฑ
print(2.0**3) # 8.0๋๋์
๋๋์ ์ ์ ์ํ ์ ์ํ์ด์ด๋ ํญ์ ์์ํ์ผ๋ก ๋์จ๋ค.
print(7 / 2) # 3.5
print(6 / 2) # 3.0
print(7.0 / 2) # 3.5
print(6.0 / 2.0) # 3.0floor division (๋ฒ๋ฆผ ๋๋์ )
๋ฒ๋ฆผ ๋๋์ ์ ํ ๋ ํ๋๋ผ๋ ์์ํ์ด๋ฉด ๊ฒฐ๊ณผ๊ฐ์ ์์ํ์ผ๋ก ๋์จ๋ค. -> ์๋ ๊ฒฐ๊ณผ ๊ฐ์ .0๋ง ๋ถ๋๋ค.
# floor division (๋ฒ๋ฆผ ๋๋์
)
print(7 // 2) # 3
print(8 // 3) # 2
print(8.0 // 3) # 2.0
print(8 // 3.0) # 2.0
print(8.0 // 3.0) # 2.0
# round (๋ฐ์ฌ๋ฆผ)
print(round(3.1415926535)) # 3
print(round(3.1415926535, 2)) # 3.14
print(round(3.1415926535, 4)) # 3.1416ํค๋ณด๋๋ก ์ธ ์ ์๋ ๋ฌธ์๋ค์ ํํํ๋ ์๋ฃํ
'์ฌํฌ'
์ญ์ฌ๋์ฌ๋ฅผ ์จ์ ๋ฌธ์์ด์์ ๋ฐ์ดํ๋ฅผ ์๋ํ์์ ์๋ ค์ค๋ค.
print("I\'m\"excited\" to learn Python!")๊ฐ์ ํ ์๋ฃํ์์ ๋ค๋ฅธ ์๋ฃํ์ผ๋ก ๋ฐ๊พธ๋ ๊ฒ
print(int(3.8)) # 3
print(float(3)) # 3.0print(int("2") + int("5")) # 7
print(float("1.1") + float("2.5")) # 3.6
print(str(2) + str(5)) # 25age = 23
print("์ ๋์ด๋" + str(age) + "์ด์
๋๋ค.")print(int("Hello World!")) -> ์ค๋ฅ (๋
ผ๋ฆฌ์ ์ผ๋ก ๋ง์ด ์ ๋จ)๋ฌธ์์ด ํฌ๋งคํ
year = 2023
month = 8
day = 1
print("์ค๋์ " + str(year) + "๋
" + str(month) + "์ " + str(day) + "์ผ์
๋๋ค.")
print("์ค๋์ {}๋
{}์ {}์ผ์
๋๋ค.".format(year, month, day))
date_string = "์ค๋์ {}๋
{}์ {}์ผ์
๋๋ค."
print(date_string.format(year, month, day))format ๋ค๋ฃจ๊ธฐ
num_1 = 1
num_2 = 2
print("{0} ๋๋๊ธฐ {1}์ {2}์
๋๋ค.".format(num_1, num_2, num_1 / num_2)) # 1 ๋๋๊ธฐ 2์ 0.5์
๋๋ค.
# f๋ float์ f
# :.2f -> ์์์ ๋์งธ์๋ฆฌ๋ก ๋ฐ์ฌ๋ฆผ ํด๋ผ
# ์ ์๋ก ๋ฐ๊พธ๊ณ ์ถ๋ค๋ฉด :.0f
print("{0} ๋๋๊ธฐ {1}์ {2:.2f}์
๋๋ค.".format(num_1, num_2, num_1 / num_2)) # 1 ๋๋๊ธฐ 2์ 0.50์
๋๋ค.f-string
ํ์ด์ฌ ๋ฒ์ 3.6๋ถํฐ ์๋กญ๊ฒ ๋์จ ๋ฐฉ์
name = "์ฌํฌ"
age = 23
print(f"์ ์ด๋ฆ์ {name}์ด๊ณ {age}์ด์
๋๋ค.") # ์ ์ด๋ฆ์ ์ฌํฌ์ด๊ณ 23์ด์
๋๋ค.wage = 5 # ์๊ธ (1์๊ฐ์ 5๋ฌ๋ฌ)
exchange_rate = 1142.16 # ํ์จ (1๋ฌ๋ฌ์ 1142.16์)
# "1์๊ฐ์ 5๋ฌ๋ฌ ๋ฒ์์ต๋๋ค."
print("{}์๊ฐ์ {}{} ๋ฒ์์ต๋๋ค.".format(1, wage * 1, "๋ฌ๋ฌ"))
# "5์๊ฐ์ 25๋ฌ๋ฌ ๋ฒ์์ต๋๋ค."
print("{}์๊ฐ์ {}{} ๋ฒ์์ต๋๋ค.".format(wage, wage**2,"๋ฌ๋ฌ"))
# "1์๊ฐ์ 5710.8์ ๋ฒ์์ต๋๋ค."
print("{}์๊ฐ์ {:.1f}{} ๋ฒ์์ต๋๋ค.".format(1, exchange_rate*wage, "์"))
# "5์๊ฐ์ 28554.0์ ๋ฒ์์ต๋๋ค."
print("{}์๊ฐ์ {:.1f}{} ๋ฒ์์ต๋๋ค.".format(wage, wage*(exchange_rate*wage), "์"))์ง๋ฆฌ๊ฐ true, false
AND, OR, NOT
์ฐธ ๋๋ ๊ฑฐ์ง์ด ํ์คํ ๋ฌธ์ฅ
x์ y๊ฐ ๋ชจ๋ ์ฐธ์ผ ๋๋ง x AND y๊ฐ ์ฐธ์ด๋ค.
๋ํ๋ฏผ๊ตญ์ ์๋๋ ์์ธ์ด๋ค. AND 2๋ 1๋ณด๋ค ํฌ๋ค.
-> ๋๋ค TRUE์ด๋ฏ๋ก TRUEx์ y ์ค ํ๋๋ผ๋ ์ฐธ์ด๋ฉด x OR y๊ฐ ์ฐธ์ด๋ค.
๋ ๋ค ๊ฑฐ์ง์ด์ด์ผ FALSE๋ค.
๋ํ๋ฏผ๊ตญ์ ์๋๋ ์์ธ์ด๋ค. OR ๋ํ๋ฏผ๊ตญ์ ์๋๋ ์ ์ฃผ๋๋ค.
-> ํ๋๋ผ๋ TRUE์ด๋ฏ๋ก TRUETRUE๋ฉด FALSE, FALSE๋ฉด TRUE๋ก ๋ง๋ค์ด ์ค๋ค.
NOT ๋ํ๋ฏผ๊ตญ์ ์๋๋ ์์ธ์ด๋ค.
-> ๋ํ๋ฏผ๊ตญ์ ์๋๋ ์์ธ์ด ์๋๋ค. -> FALSE
NOT 2๋ 1๋ณด๋ค ์๋ค.
-> 2๋ 1๋ณด๋ค ์์ง ์๋ค. -> TRUE์ฐธ๊ณผ ๊ฑฐ์ง (True, False)
print(not not True) # not False -> True
print(not not False) # not True -> Falseprint(7 == 7 or (4 < 3 and 12 > 10)) # Truex = 3
print(x > 4 or not (x < 2 or x == 3)) # Falseprint(type(4 / 2))
# 4 / 2๋ 2.0์ด๋ค. ๋ฐ๋ผ์ <class 'int'>๊ฐ ์๋๋ผ <class 'float'>๊ฐ ์ถ๋ ฅ๋๋ค.
# ๋๋์
์ ํ ๊ฒฝ์ฐ ํญ์ ์ค์ ๊ฐ์ผ๋ก ๋๋ ค์ค๋ค.def hello():
print("Hello world!")
print(type(hello)) # <class 'function'>
print(type(print)) # <class 'builtin_function_or_method'>
# ํจ์๋ ํ๋์ ์๋ฃํ์ด๋ค.
# builtin_function -> ๋ด์ฅ๋์ด ์๋ ํจ์๋ฑํธ : ์ง์ ์ฐ์ฐ์
- ๊ฐ ๋๋ ค์ฃผ๊ธฐ
- ํจ์ ์ฆ์ ์ข ๋ฃํ๊ธฐ
def square(x):
print("ํจ์ ์์")
return x * x
print("ํจ์ ๋") # Dead Code (์๋ฏธ ์๋ ์ฝ๋)
print(square(3))
print("Hello world")
# ํจ์ ์์
# 9
# Hello worldreturn ํ๋ ๊ฒ ์์ผ๋ฉด None
def print_square(x):
print(x * x)
def get_square(x):
return (x * x)
get_square(3) # ๊ทธ๋ฅ ์๊ฒ๋ ์์
print(get_square(3)) # 9
print(print_square(3))
# 9
# Noneํ๋ผ๋ฏธํฐ์ '๊ธฐ๋ณธ๊ฐ(default value)'์ ์ค์ ํ ์ ์๋ค. ์ด๋ฐ ํ๋ผ๋ฏธํฐ๋ฅผ '์ต์ ๋ ํ๋ผ๋ฏธํฐ(optional parameter)'๋ผ๊ณ ํ๋ค.
def myself(name, age, nationality="ํ๊ตญ"):
print("๋ด ์ด๋ฆ์ {}".format(name))
print("๋์ด๋ {}์ด".format(age))
print("๊ตญ์ ์ {}".format(nationality))
myself("์ฌํฌ", 23, "๋ฏธ๊ตญ") # ์ต์
๋ ํ๋ผ๋ฏธํฐ๋ฅผ ์ ๊ณตํ๋ ๊ฒฝ์ฐ
# ๋ด ์ด๋ฆ์ ์ฌํฌ
# ๋์ด๋ 23์ด
# ๊ตญ์ ์ ๋ฏธ๊ตญ
print()
myself("์ฌํฌ", 23) # ์ต์
๋ ํ๋ผ๋ฏธํฐ๋ฅผ ์ ๊ณตํ์ง ์๋ ๊ฒฝ์ฐ
# ๋ด ์ด๋ฆ์ ์ฌํฌ
# ๋์ด๋ 23์ด
# ๊ตญ์ ์ ํ๊ตญ์ต์ ๋ ํ๋ผ๋ฏธํฐ๋ ๋ชจ๋ ๋ง์ง๋ง์ ์์ด์ผ ํ๋ค. ์๋์ฒ๋ผ ์ต์ ๋ ํ๋ผ๋ฏธํฐ๋ฅผ ์ค๊ฐ์ ๋ฃ์ผ๋ฉด ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ค.
def myself(name, nationality="ํ๊ตญ", age):
print("๋ด ์ด๋ฆ์ {}".format(name))
print("๋์ด๋ {}์ด".format(age))
print("๊ตญ์ ์ {}".format(nationality))
myself("์ฌํฌ", 1) # ๊ธฐ๋ณธ๊ฐ์ด ์ค์ ๋ ํ๋ผ๋ฏธํฐ๋ฅผ ๋ฐ๊พธ์ง ์์ ๋
print()
myself("์ฌํฌ", "๋ฏธ๊ตญ", 1) # ๊ธฐ๋ณธ๊ฐ์ด ์ค์ ๋ ํ๋ผ๋ฏธํฐ๋ฅผ ๋ฐ๊พธ์์ ๋
# File "myself.py", line 1
def myself(name, nationality = "ํ๊ตญ", age):
^
SyntaxError: non-default argument follows default argumentSyntactic Sugar ์ด๋ ์์ฃผ ์ฐ์ด๋ ํํ์ ๋ ๊ฐ๋ตํ๊ฒ ์ธ ์ ์๊ฒ ํ๋ ๋ฌธ๋ฒ์ด๋ค.
x = x * 2
x *= 2๋ณ์๊ฐ ์ฌ์ฉ ๊ฐ๋ฅํ ๋ฒ์
๋ก์ปฌ ๋ณ์, ๊ธ๋ก๋ฒ ๋ณ์
x = 2 # ๊ธ๋ก๋ฒ ๋ณ์
def my_function():
print(x)
my_function()
print(x)
# 2
# 2x = 2 # ๊ธ๋ก๋ฒ ๋ณ์
def my_function():
x = 3 # ๋ก์ปฌ ๋ณ์
print(x)
my_function()
print(x)
# 3
# 2ํ๋ผ๋ฏธํฐ๋ ๋ก์ปฌ ๋ณ์๋ค.
์ ๋๋ก ๋ฐ๋์ง ์๋ ๊ฒ
ํ๋์ ๊ตฌ๋ถํ๊ธฐ ์ํด ์ด๋ฆ์ ๋ฌด์กฐ๊ฑด ๋๋ฌธ์๋ก ํ์
๋ชจ๋ ๋ณ์์ ํจ์ ์ด๋ฆ์ ์๋ฌธ์๋ก ์ฐ๊ณ , ์ฌ๋ฌ ๋จ์ด์ผ ๊ฒฝ์ฐ _ (์ธ๋๋ฐ)๋ก ๋๋๋ค. ๋ชจ๋ ์์ ์ด๋ฆ์ ๋๋ฌธ์๋ก ์ฐ๊ณ , ์ฌ๋ฌ ๋จ์ด์ผ ๊ฒฝ์ฐ _ (์ธ๋๋ฐ)๋ก ๋๋๋ค.
๋ค์ฌ์ฐ๊ธฐ๋ ๋ฌด์กฐ๊ฑด ์คํ์ด์ค 4๊ฐ๋ฅผ ์ฌ์ฉํ๋ค.
ํจ์ ์ ์ ์์๋๋ก ๋น ์ค์ด ๋ ๊ฐ์ฉ ์์ด์ผ ํ๋ค.
๊ดํธ ๋ฐ๋ก ์์๋ ๋์ด์ฐ๊ธฐ๋ฅผ ํ์ง ๋ง์์ผ ํ๋ค. ์ผํ ์์๋ ๋์ด์ฐ๊ธฐ๋ฅผ ํ์ง ๋ง์์ผ ํ๋ค.
๊ธฐ๋ณธ์ ์ผ๋ก๋ ์ฐ์ฐ์ ์๋ค๋ก ๋์ด์ฐ๊ธฐ๋ฅผ ํ๋์ฉ ํ๋ค.
i = 1
while i <= 9:
j = 1
while j <= 9:
print("{} * {} = {}".format(i, j, i * j))
j += 1
i += 1elif ๋ฌธ
i = 1
while i <= 100:
if i % 8 == 0 and i % 12 != 0:
print(i)
i += 1i = 1
total = 0
while i < 1000:
if i % 2 == 0 or i % 3 == 0:
total += i
i += 1
print(total)numbers[2:]
-> index 2๋ถํฐ ๋ง์ง๋ง๊น์ง
numbers[:3]
-> ์ฒ์๋ถํฐ index 2๊น์ง
numbers[0:3]
-> 0๋ถํฐ index 2๊น์ง
numbers = []
numbers.append(5) # [5]
numbers.append(8) # [5, 8]
len(numbers) # 2del -> ์ญ์
numbers = [2, 3, 5, 7]
del numbers[3]
print(numbers) # [2, 3, 5]insert -> ์ฝ์ (์ํ๋ ์์น์ ์ฝ์ ๊ฐ๋ฅ)
numbers = [2, 3, 5, 7]
numbers.insert(4, 37)
print(numbers) # [2, 3, 5, 7, 37]sorted : ๊ธฐ์กด ๋ฆฌ์คํธ๋ ๊ฑด๋๋ฆฌ์ง ์๊ณ ์ ๋ ฌ๋ ์๋ก์ด ๋ฆฌ์คํธ๋ฅผ ๋ฆฌํด
numbers = [2, 5, 3, 7]
new_list = sorted(numbers)
print(new_list) # [2, 3, 5, 7]๋ด๋ฆผ์ฐจ์
numbers = [2, 5, 3, 7]
new_list = sorted(numbers, reverse=True)
print(new_list) # [7, 5, 3, 2]sort : ์๋ฌด๊ฒ๋ ๋ฆฌํดํ์ง ์๊ณ ๊ธฐ์กด ๋ฆฌ์คํธ๋ฅผ ์ ๋ ฌ
numbers = [2, 5, 3, 7]
print(numbers.sort()) # None
numbers = [2, 5, 3, 7]
numbers.sort()
print(numbers) # [2, 3, 5, 7]numbers = [2, 5, 3, 7]
numbers.sort(reverse=True)
print(numbers) # [7, 5, 3, 2]grades = [[62, 75, 77], [78, 81, 86], [85, 91, 89]]
# ์ฒซ ๋ฒ์งธ ํ์์ ์ฑ์
print(grades[0])
# ์ธ ๋ฒ์งธ ํ์์ ์ฑ์
print(grades[2])
# ์ฒซ ๋ฒ์งธ ํ์์ ์ฒซ ๋ฒ์งธ ์ํ ์ฑ์
print(grades[0][0])members = ["์ํ", "์ค์", "ํํธ", "ํ๋ฆฐ"]
print(members.index("์ค์")) # 1
print(members.index("ํํธ")) # 2range
๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ good
for i in range(start, stop):
print(i)
# start ๋ถํฐ stop - 1๊น์ง์ ๋ฒ์for i in range(10):
print(i)
# 0๋ถํฐ 9๊น์ง์ ๋ฒ์for i in range(start, stop, step):
print(i)
# start ๋ถํฐ stop - 1๊น์ง์ ๋ฒ์, ๊ฐ๊ฒฉ stepkey-value ์
์์๋ผ๋ ๊ฐ๋ ์ด ์์, ์ฌ์ ์ key๋ ๋ฌธ์์ด, ์ ์ํ ๋ค ๊ฐ๋ฅ
my_dictionary = {
5: 25,
2: 4,
3: 9
}
print(type(my_dictionary)) # dict
print(my_dictionary[3]) # 9
my_dictionary[9] = 81
print(my_dictionary) # { 5: 25, 2: 4, 3: 9, 9: 81 }values
my_dictionary = {
5: 25,
2: 4,
3: 9
}
print(my_dictionary.values()) # dict_values([25, 4, 9])
print(25 in my_dictionary.values()) # True
print(20 in my_dictionary.values()) # False
for value in my_dictionary.values():
print(value)
# 25
# 4
# 9
for key in my_dictionary.keys():
print(key)
# 5
# 2
# 3items
for key in my_dictionary.keys():
value = my_dictionary[key]
print(key, value)
# 5 25
# 2 4
# 3 9
for key, value in my_dictionary.items():
print(key, value)
# 5 25
# 2 4
# 3 9x = [2, 3, 5, 7, 11]
y = list(x) # ๋ณต์ ํจ์ผ๋ก์จ x์ ๋ฆฌ์คํธ๊ฐ ๋ฐ๋์ง ์๊ฒ ํจ
y[2] = 4
print(x) # [2, 3, 5, 7, 11]
print(y) # [2, 3, 4, 7, 11]๋ฆฌ์คํธ๋ ์์ ๊ฐ๋ฅ, ๋ฌธ์์ด์ ์์ ๋ถ๊ฐ
๊ธฐ๋ฅ๋ค์ ์ ๋ฆฌํด ๋์ ๊ฒ
import math
import os
import randomrandint()
randint(a, b) -> a, b ๋ ์ ์ฌ์ด์ ์ด๋ค ๋๋คํ ์ ์๋ฅผ ๋ฆฌํดํ๋ ํจ์
import random
print(random.randint(1, 20)) # 1๋ถํฐ 20๊น์ง ์๋ฌด ์ซ์ 1๊ฐuniform()
๋ ์ ์ฌ์ด์ ๋๋คํ ์์๋ฅผ ๋ฆฌํดํ๋ ํจ์
uniform(a, b)๋ฅผ ํ๋ฉด, a โค N โค b๋ฅผ ๋ง์กฑํ๋ ์ด๋ค ๋๋คํ ์์ N์ ๋ฆฌํดํ๋ค.
datetime
pi_day = datetime.datetime(2020, 3, 14) # 2020-03-14 00:00:00
pi_day = datetime.datetime(2020, 3, 14, 13, 6, 15) # 2020-03-14 13:06:15
today = datetime.datetime.now() # 2023-08-04 17:49:12.360266
today = datetime.datetime.now()
print(today)
print(today.year) # ์ฐ๋
print(today.month) # ์
print(today.day) # ์ผ
print(today.hour) # ์
print(today.minute) # ๋ถ
print(today.second) # ์ดwith open("file.txt", "r") as f: # r์ read, w์ write, a๋ append
for line in f:
print(line)print ๋ฌธ์ ์ถ๋ ฅ๋ ๋ ๊ธฐ๋ณธ์ ์ผ๋ก ํ ์ค ์ํฐ๊ฐ ๋
strip์ ํ์ดํธ ์คํ์ด์ค (๊ณต๋ฐฑ)์ ์์ ์ค๋ค.
print(" abc def ".strip()) # abc def
with open("file.txt", "r") as f:
for line in f:
print(line.strip()) # ์ค ๊ฑด๋๋ ์ฌ๋ผ์งstring = "1. 2. 3. 4. 5. 6"
print(string.split(".")) # ['1', ' 2', ' 3', ' 4', ' 5', ' 6']
print(string.split(". ")) # ['1', '2', '3', '4', '5', '6']
name = "Han, Seulhee"
print(name.split(", ")) # ['Han', 'Seulhee']with open('data/chicken.txt', 'r') as f:
total_revenue = 0
total_days = 0
for line in f:
data = line.strip().split(": ")
revenue = int(data[1]) # ๊ทธ๋ ์ ๋งค์ถ
total_revenue += revenue
total_days += 1
print(total_revenue / total_days)with open("new_file.txt", "w") as f:
f.write("์๋
")
f.write("๋ ์ฌํฌ์ผ")
# ์๋
๋ ์ฌํฌ์ผ
with open("new_file.txt", "w") as f:
f.write("์๋
\n")
f.write("๋ ์ฌํฌ์ผ\n")
# ์๋
# ๋ ์ฌํฌ์ผ
with open("new_file.txt", "a") as f: # a ๋ append (ํ์ผ์ด ์์ด๋ a๋ฅผ ์ฌ์ฉํ ์ ์๋ค.)
f.write("์๋
\n")
f.write("๋ ์ฌํฌ์ผ\n")
# ์๋
# ๋ ์ฌํฌ์ผ
# ์๋
# ๋ ์ฌํฌ์ผwith open('vocabulary.txt', 'r') as f:
for line in f:
data = line.strip().split(": ")
english_word, korean_word = data[0], data[1]
# ์ ์ ์
๋ ฅ๊ฐ ๋ฐ๊ธฐ
guess = input("{}: ".format(korean_word))
# ์ ๋ต ํ์ธํ๊ธฐ
if guess == english_word:
print("๋ง์์ต๋๋ค!\n")
else:
print("์์ฝ์ต๋๋ค. ์ ๋ต์ {}์
๋๋ค.\n".format(english_word))