Skip to content

Commit aea9942

Browse files
committed
DAY 6 OF 14 PYTHON CHALLENGE
1 parent 0b43f1a commit aea9942

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Assignment 2/DAY 6 OF 14 PYTHON CHALLENGE.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,22 @@ def ask_amount(a_country, b_country):
7676
amount = ask_amount(user_country, target_country)
7777

7878

79+
# 환전 사이트
7980
currency_url = "https://transferwise.com/gb/currency-converter/"
8081

82+
# code 값
8183
user_code = user_country['code']
8284
target_code = target_country['code']
8385

8486
# KRW => USD 10000원 환전 url = {https://transferwise.com/gb/currency-converter/}{krw}-to-{usd}-rate?amount={10000}
8587
currency_request = requests.get(f"{currency_url}{user_code}-to-{target_code}-rate?amount={amount}")
8688
currency_soup = BeautifulSoup(currency_request.text, "html.parser")
87-
89+
# 환전한 amount를 보여주는 input란을 가지고옴
8890
currency_result = currency_soup.find("input", {"id": "cc-amount-to"})
8991
if currency_result:
9092
currency_result = currency_result['value']
93+
# 처음에 입력한 amount
9194
amount = format_currency(amount, user_code, locale="ko_KR")
95+
# 환전해서 나온 amount
9296
currency_result = format_currency(currency_result, target_code, locale="ko_KR")
9397
print(f"{amount} is {currency_result}")

0 commit comments

Comments
 (0)