Workout #35b: Gemtria part 2

Oct 27, 2021

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 the function is called with the word cat, with a gematria value of 24 (3 + 1 + 20), then the function will return a list of strings, all of whose gematria values are also 24. (This will be a long list!) Any nonlowercase characters in the user’s input should count 0 toward our final score for the word. Your source for the dict words will be the Unix file you used earlier in this chapter, which you can load into a list comprehension.

TRY IT YOURSELF

ANSWER

https://colab.research.google.com/drive/1Q1mSrNqWv3emIuKJGaNZRqdjhzjCvm1L?usp=sharing

--

--

Abish Pius
Abish Pius

Written by Abish Pius

Data Science Professional, Python Enthusiast, turned LLM Engineer

No responses yet