Code Kata: Translate a decimal text to roman

A code kata is a an exercise of coding where the objective is to use simple requirements to train the coding and testing skills.You can use it to train brainstorming and analysis within the team as well.

The subjacent idea is to use the martial arts concept of kata to coding, where repetition leads to perfection.

A few tips:

  • Try to fit the analysis, coding and testing within a small range of time, like 2 hours or less.
  • Remember if it takes too long or demands a big effort, there will be no motivation to repeat it in another session.
  • Most of the exercises exist to train the TDD methodology.
  • You can find several exercises in the internet for your use, or just invent one yourself.

Translate a decimal text to roman

Imagine you have a text, or a list of texts, such as the one below, with words and numbers.
(or just write a text with words and numbers):

You want to replace all the decimal numbers with roman numbers

That said, there is also considerable cause for optimism among those who support OER. The awareness and adoption levels may be low, but they also show steady year-to-year improvements. For example, the open-licensed textbook adoption rate of 9% for 2016-17 represents a substantial increase over the rate of 5% for 2015-16. Likewise, awareness of both Creative Commons licensing and OER itself has increased each year.
OER also addresses a key concern of many faculty: the cost of materials. A majority of faculty classify cost as “Very important” for their selection of required course materials. Faculty report that their required textbooks have an average price of $97, and only 22% say that they are “Very satisfied” with that cost. It is therefore not surprising that most faculty report that not all of their students buy all the required texts for their class, with only a third saying that 90% or more of their students have purchased the required textbook.

Have a nice session!


If you implement this kata and you publish it in the internet, be kind a refer to this article. 😃

The text used in the exercise was extracted from a text file I have found in the internet. There is no special meaning to consider.

Book review: A brief history of the paradox by Roy Sorensen

The oldest recorded paradox is from Anaximander: “Does each thing have an origin?”
He answers no: there is an infinite being that sustains everything else but which is not grounded in any other thing. This answer tries to run away from the infinite loop created by the question, since everything that exists was created by a consequence of something before.
The past can be a challenge to explain, what about the future?
Does each thing end?, and now we are on the same challenge. If it ends, what happens next?

The book, starts with the first recorded paradox and continues through time and areas of knowledge, such as philosophy, science,etc, and you start to see how some paradoxes are just old paradoxes in other areas.

What I like about this book, it is not a catalog of paradoxes. For each paradox there is a history behind it, sometimes as a consequence of other paradoxes, and the author writes it very well.

You can find, in 24 chapters, near 400 pages, discussions such as:

  • Pythagoras’s Search for the Common Denominator
  • Socrates: The Paradox of Inquiry
  • Aquinas: Can God Have a Biography?
  • Kant and the Antinomy of Pure Reason
  • Russell’s Set
  • Ockham and the Insuolubilia
  • And the usual suspects such as the negative paradoxes and similares.

I love paradoxes, since they are the “living” proof that, limits exist in our thinking and science. They are the obstacles in our progress for a better understanding of the universe in every area. And as every obstacle, they exist to show our errors and works as an opportunity for us to be better.

There are several books about paradoxes, many of them work as a catalog. But this one, is not about specific paradoxes, but about the Paradox, and its history in different areas such as philosophy, science, religion and others.
I always love a good history, and when it is about paradoxes, that’s a plus.

You can find the book here:

Book Review: Intuition Pumps from Daniel C. Dennett

Intuition pumps, and other tools for thinking, from Daniel C. Dennett is what the title says, a set of small chapters/tools, usually 2 to 4-5 pages to make you think, and so, gaining a new tool for your mental process.

The book has several sets of these intuition pumps, I will highlight these:

  • General Thinking Tools
  • Tools about meaning or content
  • Tools for thinking about evolution
  • Tools for thinking about consciousness
  • Tools for thinking about free will

This book has around 70 of these tools, as the author calls them. If you read one every day, you can read it in 2-3 months.
Since each tool fits in just a few pages, this is the kind of book you read when you just want a nugget of wisdom, at home, in a train or you just need to kill a few minutes and you don’t know what to choose to read. You will never go wrong about improving your thinking skills!

Of course, the first chapter is about making mistakes, the subject most discussed everywhere about success.
But other subjects such as: Occam’s Razor, where the author explains its origin from an older rule of thumb lex parsimaniae, or the law of parsimony, meaning in simple terms Do not multiply entities beyond necessity

The murder in Trafalgar Square is a very interesting discussion about how an event is perceived using different senses, however everyone understands it to be the same thing. Imagine a person gets shot in Trafalgar Square, one does it, another sees it, another receives the news by hearing and imagine it. If all these persons come together they can talk about it to some degree, although only one of them really experienced it. What is reality?

Or, if someone implants you a lie in your brain without you know about it, how much time do you think it will take for your brain to discover it, since there are no experiences registered in your brain that explains that lie! Is really impressions, memories or experiências?
I really loved this one.

I liked this book, since it challenges the perception we have about the reality around us and within ourselves. Every time I finish one of the intuition pumps my mind keeps thinking about it for while, which means it has found value in the reading.

The book accomplishes what proposes to achieve, just Intuition Pumps, and other tools for thinking

You can find it in amazon Here


Jupyter notebook – Execute with parameters using CLI

Jupyter notebook – Execute from Command Line with parameters

The best way to execute a jupyter notebook with parameters is to use Papermill

  1. install: pip install papermill
  2. create a cell at the start of your jupyter notebook and add the tag: parameters
  3. add your variables to that cell
  1. and execute the command

papermill my-jupyter-notebook.ipynb my-output-notebook.ipynb -p project_key data-science-proj-key -p date '2021-08-01'

  • --p – the variable name and the value to be injected

More details here: papermill@github

Jupyter Notebook – Execute from Command Line

Jupyter notebook – Execute from Command Line

A typical command to execute a jupyter notebook from command line:

jupyter nbconvert --to notebook --execute mynotebook.ipynb --output output-name

  • --to notebook – the output format
  • --execute – the name of the notebook to be executed
  • --output – an optional name for the generated file

One question sometimes asked is if it is possible to pass parameters to a jupyter notebook.

  • Yes, it is possible, but you need help from papermill. See my next posts for more details.

Jupyter notebook – export to html

Jupyter notebook – Export to HTML

A typical command to export a jupyter notebook to html:

jupyter nbconvert my-notebook.ipynb --to html --no-input --no-prompt --output my-notebook-html

  • --to html – the output format
  • --no-input – without the python code
  • --no-prompt – remove the prompts from the output
  • --output – an optional name for the html generated file