Python Variables
💡
Exercise 10

Currency 15 XP Easy

Ctrl+Enter Run Ctrl+S Save

Let's combine what we've learned! String concatenation lets us join strings together using +:

greeting = 'Hello' + ' ' + 'World' print(greeting) # Hello World

To mix strings and numbers, convert the number to a string with str():

age = 25 print('I am ' + str(age) + ' years old')

Or use f-strings (formatted strings) — the modern way:

age = 25 print(f'I am {age} years old')
📋 Instructions
You have `420` US dollars. The conversion rate to Japanese Yen is `149.50`. Create variables and calculate the Yen amount: ```python usd = 420 rate = 149.50 yen = usd * rate ``` Print the result using an f-string: ``` 420 USD is 62790.0 JPY ```
Calculate yen = usd * rate, then use print(f'{usd} USD is {yen} JPY'). You've got this — take it step by step!
⚠️ Try solving it yourself first — you'll learn more!
greeting = 'Hello' + ' ' + 'World'
print(greeting)  # Hello World
🧪 Test Cases
Input
Run your code
Expected
420 USD is 62790.0 JPY
Expected program output
main.py
Hi! I'm Rex 👋
Output
Ready. Press ▶ Run or Ctrl+Enter.