How many times can you spend money on nothing?

The other day I was taking a shower and a thought came to me: How many times can I exchange a dollar to Colones
(Costa Rican currency) then back to dollars and then to colones and so on until I have no money left?

I got out the shower and wrote this simple python script, turns out the answer is 111 (well at that moment because it depends of the exchange rate).

I’ll leave a repl.it so you can play a bit with it.

Little doc of the function always is nice.

This solution may not be the most efficient or glamorous so I am curious to see if some of you come up with a more clever way to solve this shower problem.

If you want to receive more stuff like this you can join to my new newsletter :)

Physicist turned data scientist. Creator of http://datasciencetrivia.com a Q&A card game to learn key data science concepts by playing.

Physicist turned data scientist. Creator of http://datasciencetrivia.com a Q&A card game to learn key data science concepts by playing.