My Coding Quiz #42

in #hive-19768511 months ago

My Coding Quiz #42 👨‍💻🛠️🧩

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...




Quiz
By @eniolw


What's your choice?

Solution to the previous quiz: 3. First a list called songs is created with four song titles. If you are familiar with Aurora Aksnes, you will probably recognise these song names.

Then a second list called played is created containing 'Soft ' 'universe'. There is no syntactic error or missing comma or anything similar here. We've already discussed that these strings isolated in this way are automatically concatenated by Python, so they really consist of the single string 'Soft universe'.

We then do a set difference using the - operator instead of the difference method. This operation compares two sets and creates a new one with those items that are in the first set, but are not in the second set.

In our example, we see that the items 'Little boy in the grass', 'It happened quiet' and 'Forgotten love' are in songs, but not in played, so they constitute the newly created anonymous set. This set is converted into a list and from it we are interested in its size, which is 3.


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 and others.


Mi Quiz de Programación #42 👨‍💻🛠️🧩

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...




Quiz
Por @eniolw


¿Cuál es tu elección?

Solución al quiz anterior: 3. Primero se crea una lista llamada songs con cuatro títulos de canciones. Si estás familiarizado con Aurora Aksnes, probablemente reconocerás los nombres de estas canciones.

Luego se crea una segunda lista llamada played que contiene 'Soft ' 'universe'. Aquí no hay ningún error sintáctico ni falta una coma ni nada similar. Ya hemos comentado que Python concatena automáticamente estas cadenas aisladas de esta manera, por lo que en realidad consisten en una sola cadena: 'Soft universe'.

Luego hacemos una diferencia de conjuntos usando el operador - en lugar del método difference. Esta operación compara dos conjuntos y crea uno nuevo con aquellos elementos que están en el primer conjunto, pero no en el segundo.

En nuestro ejemplo, vemos que los elementos 'Little boy in the grass', 'It happened quiet' y 'Forgotten love' están en songs, pero no en played, por lo que constituyen el conjunto anónimo recién creado. Este conjunto se convierte en una lista y de ella nos interesa su tamaño, que es 3.


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 y otras.

Sort:  

@tipu curate 8

Gracias!

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. 
 

This post has been manually curated by @bhattg from Indiaunited community. Join us on our Discord Server.

Do you know that you can earn a passive income by delegating to @indiaunited. We share more than 100 % of the curation rewards with the delegators in the form of IUC tokens. HP delegators and IUC token holders also get upto 20% additional vote weight.

Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.

image.png

100% of the rewards from this comment goes to the curator for their manual curation efforts. Please encourage the curator @bhattg by upvoting this comment and support the community by voting the posts made by @indiaunited.

Thank you, @bhattg and @indiaunited!