My Coding Quiz #32
My Coding Quiz #32 👨💻🛠️🧩
Welcome to the new installment of my series of Coding Quizzes, in which you will be able to test your knowledge and skills about programming and software development in a simple and fun way. If you want to learn more about it visit my blog here on Hive and the first post where I introduced it.
Without further ado, here's the riddle...
By @eniolw
What's your choice?
Solution to the previous quiz: stem. First we create a string base
that has several unintelligible characters, but that doesn't matter. Line 2 converts them into a list using the powerful Python list comprehension mechanism. That list in turn is transformed into a set in line 3 using the set
constructor. A set is, simply put, an unordered collection of unique elements.
In our case, the set a
will be formed by all the characters in base
, noting that as the character 'h' is duplicated in base
, it will not be duplicated in a
, since sets do not have duplicates by definition.
Then, line 4 presents the difference operation that applies to two sets. We see that it applies to a
and b
. The way to read that instruction is which elements are in a
that are not in b
. We have that:
a = {'m', 'c', 'e', 'n', 'a', 'h', 't', 's', 'i'}
And
b = {'c', 'n', 'h', 'a', 'i'}
The difference a - b
is the set:
c = {'s', 'm', 't', 'e'}
The object returned by difference
is a new set. In the final line, the set c
is converted to a list and then converted to a string using join
. What is printed is an anagram of 'stem', that is, a word with the same letters that stem has.
Enthusiast @gabrielr29 came up with the right answer. Congratulations.
If you want to blog about computer science and programming content, I invite you to join Hive and participate in its communities, such as STEM-social, Develop Spanish, Programming & Dev, Hive Learners and others.
Mi Quiz de Programación #32 👨💻🛠️🧩
Bienvenido a mi nueva serie de Quizzes de Programación, en la cual podrás poner a prueba tus conocimientos y habilidades sobre programación y desarrollo de software de una manera sencilla y divertida. Si quieres aprender más sobre ella visita mi blog aquí en Hive y el primer post donde la presenté.
Sin más preámbulos, he aquí el acertijo...
Por @eniolw
¿Cuál es tu elección?
Solución al quiz anterior: stem. Primero creamos una cadena base
que tiene varios caracteres ininteligibles, pero eso no importa. La línea 2 los convierte en una lista utilizando el poderoso mecanismo de comprensión de listas de Python. Esa lista a su vez se transforma en un conjunto en la línea 3 usando el constructor set
. Un conjunto es, en pocas palabras, una colección desordenada de elementos únicos.
En nuestro caso, el conjunto a
estará formado por todos los caracteres de base
, teniendo en cuenta que como el carácter 'h' es duplicado en base
, no se duplicará en a
, ya que los conjuntos no tienen duplicados por definición.
Luego, la línea 4 presenta la operación de diferencia que se aplica a dos conjuntos. Vemos que se aplica a a
y b
. La forma de leer esa instrucción es qué elementos están en a
y no en b
. Tenemos que:
a = {'m', 'c', 'e', 'n', 'a', 'h', 't', 's', 'i'}
Y
b = {'c', 'n', 'h', 'a', 'i'}
La diferencia a - b
es el conjunto:
c = {'s', 'm', 't', 'e'}
El objeto devuelto por difference
es un conjunto nuevo. En la línea final, el conjunto c
se convierte en una lista y luego se convierte en una cadena usando join
. Lo que está impreso es un anagrama de 'stem', es decir, una palabra con las mismas letras que tiene stem.
El entusiasta @gabrielr29 dio con la respuesta correcta. Felicitaciones.
Si quieres bloguear sobre contenido informático y de programación, te invito a unirte a Hive y participar en sus comunidades, tales como STEM-social, Develop Spanish, Programming & Dev, Hive Learners y otras.
!DHEDGE
you have 0.0 vote calls available today, your vote calls will reset at next snapshot. You can buy DHEDGE on Tribaldex or earn some daily by joining one of our many delegation pools at app.dhedge.cc to increase your daily amount.
Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!
Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).
You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.
I guess it's the last choice. 🤞 !PGM
BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!
The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]
5000 PGM IN STAKE = 2x rewards!
Discord
Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP
Get potential votes from @ pgm-curator by paying in PGM, here is a guide
I'm a bot, if you want a hand ask @ zottone444
OK! We'll see about that in the next installment :)
Haha, no, that's not it, you're not hopeless.