Exercise on Control Flow

Here is an exercise you can solve to test your understanding!

We'll cover the following

Question

You have 50 bitcoins to distribute to 10 users: Matthew, Sarah, Augustus, Heidi, Emilie, Peter, Giana, Adriano, Aaron, Elizabeth.

The coins will be distributed based on the vowels contained in each name where:

a: 1 coin

e: 1 coin

i: 2 coins

o: 3 coins

u: 4 coins

A user can’t get more than 10 coins. For example, for ‘Augutus’ the total count of coins is 13. But he’ll get only 10 (13-3) coins.

Print a map with each user’s name and the number of coins distributed. After distributing all the coins, you should have 2 coins left.

The output should look something like that:

Get hands-on with 1200+ tech skills courses.