Parchment Challenge¶
This challenge consists of deciphering a scroll from Python code
First let’s look at the structure of the scroll texts.
Archaeologists found a parchment with the following texts: txt_A
and txt_B
.
These scrolls are in the ancient and mysterious Googlon language. After many years of study, Linguists already know some characteristics of this language. First, Googlon letters are classified into two groups: letters z, m, b are called “zombie type letters”, while the others are known as “survivor type letters”. Linguists have discovered that prepositions on Googlon are words that begin with a zombie-type letter and end with another letter, it is easy to see that there are 71 prepositions in Text A.
Calculate how many prepositions exist in text B. Assign the result to the variable
prep_B
. Note: txt_A
and txt_B
are already defined even though they do not appear in the window
of code below.
Another interesting fact discovered by linguists is that, on Googlon, verbs are always 7-letter words that end in a survivor type letter. Furthermore, if a verb begins with a surviving type letter, the verb is in the first person. Thus, reading Text A, it is possible identify 84 verbs in the text, of which 70 are in the first person.
Calculate how many verbs there are in Text B, and assign that value to the variable verbs_B
. After
calculate how many of those verbs are in the first person, and assign that value to the variable person_1_B
.
Remember: the texts are already defined, as is the zombie
variable in the code above.
A university professor will use texts A and B to teach Googlon to students. To help students understand the text, this teacher needs to create a list of vocabulary for each text, that is, an ordered list of the words that appear in each one of the texts. These lists must be sorted. In Googlon, as in our alphabet, the words are ordered lexicographically, but the problem is that in Googlon, the order of The letters in the alphabet are different from ours. Its order is: zmbtshjpnwlrcxkqvdgf. Therefore, when making these lists, the teacher must respect Googlon’s alphabetical order.
The teacher prepared the (ordered) vocabulary list for Text A; look at it in the variable
list_A
. What would be the ordered vocabulary list for Text B? Make a program that performs
this list, and save it in the variable list_B
. Remember: the texts are already defined as
in the first exercise (Exercise 1).
But how do Googlons write numbers? Well, on Googlon, words are too numbers given in base 20, where each letter is a digit. On Googlon, the first position is the unit and corresponds to the letter to the left of the word, the second position has a value of 20, the third 400 and so on. Letter values are given in the order they appear in the Googlon alphabet (which is different from our order, as we saw above). That is, the first letter of the alphabet Googlon, which is the z, represents the digit 0, the second represents the digit 1, and so on.
For example, the word zmbzmb
has a numerical value of 6560820
. The explanation is the following:
In the Googlon alphabet, the letters z
m
and b
are the first three. If we represent that
word in digits according to the previous rules, this would be its value: 012012
. As a last step, it is necessary
convert it to base 20. According to the previous rules, the conversion is done as follows:
\((0 * 1) + (1 * 20) + (2 * 20^2) + (0 * 20^3) + (1 * 20^4) + (2 * 20^5) = 6560820\)
Googlons consider a magic number (very rare) if it satisfies one property: numerical value It is divisible by 42 (answer for everything) and all the digits are different from each other. To consider Text A as a list of numbers (i.e. interpret each word as a number using the convention explained above), we notice that there are 8 magic numbers: kpbslq, gtrpzhwb, ghfntj, ljdz, gthkq, lbqjrp, jplzc and gjw.
And in Text B, how many magic numbers are there and what are they? Save in the variable num_magicos
the number of magic numbers there are in Text B, and in the variable magic
save what they are.
Remember: The texts are already defined, as is the order
variable from the previous exercise.