Play Bad Banana online at trinket.io!

For curious readers who want to try Bad Banana, but who, understandably, would prefer not to have to download the code and run it on their systems, the game can now be safely played online at https://trinket.io/python/6a564db039?toggleCode=true&runOption=run. Toggle to Code View to see how the game works!

badbananapic

Many thanks to the people behind trinket.io, a great tool for beginners to learn about coding and to share simple programs like Bad Banana.

Donkeys, Logs, Snakes, Oh My!

01_tunapasta
For the last several years in the United States and the UK, there has been a strong push to teach primary and secondary-school students how to code. Whether this is a good idea or not, I personally have enjoyed learning about programming. One of my current hopes is to do more programming using the Python programming language.

python-logo-master-v3-tm-flattenedNow, I won’t get too much into coding—my intention for this blog is to focus on math—but I just can’t resist to somehow meld these personal and professional interests. Namely, how can I use my basic Python programming skills to explore math concepts and solve math problems?

As a starter, I thought that I would introduce readers to the Python interpreter. Basically, this is a program that accepts commands written in Python and executes them immediately. If you’re using Mac OS X or some other Linux\Unix operating system, then the chances are very strong you can just open “Terminal” or your favourite shell and type “python” to get the interpreter running. If you’re on Windows or just have no clue what I meant in the last sentence, then I recommend downloading Python and using IDLE, which you can click on to launch like any other app. I’ll be using IDLE to talk about Python in this entry and probably future ones too.

Suppose you are asked to solve the following:

Currently, there are six donkeys on Nick’s farm. The donkey population grows at a rate of 2.5 times per year. When will Nick have 18 donkeys on his farm? Round your answer to the nearest tenth of a year.*

Typically, we would solve the problem by first modelling the situation as an exponential equation and then rewrite the equation in its equivalent logarithmic form:

00_longsolution

Continue reading “Donkeys, Logs, Snakes, Oh My!”