Abish Pius

In this exercise, you’ll implement a somewhat complex (and whimsical) function, in a module, to implement tax policy in the Republic of Freedonia. The idea is that the tax system is so complex that the government will supply businesses with a Python module implementing the calculations for them.

Sales tax on purchases in Freedonia depends on where the purchase was made, as well as the time of the purchase. Freedonia has four provinces, each of which charges its own percentage of tax:

  • Chico: 50%
  • Groucho: 70%
  • Harpo: 50%
  • Zeppo: 40%

TRY IT YOURSELF

ANSWER

https://colab.research.google.com/drive/1GpnAi4qf3-4MwcQLDf3l0XkEhkdnSx3A?usp=sharing

In this exercise, you’ll write two functions:

  • gematria_for, which takes a single word (string) as an argument and returns the gematria score for that word
  • gematria_equal_words, which takes a single word and returns a list of those dict words whose gematria scores match the current word’s score.

For example, if…

Abish Pius

Abish Pius

Data Science Professional who teaches with unflashy, simple to understand python code.