February 2018
Beginner
200 pages
4h 37m
English
You’ll find how many dollars Sarah has spent by executing the following expression:
| | (10 * 0.1) + (3 * 2) + 15 |
You can show Bob’s travel stats with the following code:
| | distance = 200 |
| | hours = 4 |
| | velocity = distance / hours |
| | IO.puts """ |
| | Travel distance: #{distance} km |
| | Time: #{hours} hours |
| | Average Velocity: #{velocity} km/h |
| | """ |
The apply_tax function should be like this:
| | apply_tax = fn price -> |
| | tax = price * 0.12 |
| | IO.puts "Price: #{price + tax} - Tax: #{tax}" |
| | end |
| | |
| | Enum.each [12.5, 30.99, 250.49, 18.80], apply_tax |
Your
Read now
Unlock full access