Currency Conversion
Programming Basics · Python
TASK
Problem
Given `amount` and exchange `rate` (units of target currency per one source unit), print the converted amount.
EXAMPLE
Example
100 3.5
350.0
LIMITS
Constraints
Physical and monetary quantities that cannot be negative are non-negative; the absolute value of other numeric inputs is at most 10^9.
LEARN
Theory for this problem
+
`input()` reads data entered by the user. The result of `input()` is initially a string. `split()` separates one input line into individual values using spaces. `map()` applies the specified conversion to each input value. The `*` operator multiplies numbers. `print()` displays the program result. Print only what the problem statement requires.
**Connection to this task.** The `*` operator multiplies numeric values. In formulas it naturally models repeated contribution, such as price × quantity, speed × time, or side × side. The expression `amount * rate` shows how this idea is applied to the task data.
NEED HELP?
Hints
+
['Multiply the amount by the exchange rate.']
ANSWER
Solution
+
amount, rate = map(float, input().split()) result = amount * rate print(result)