create account

My Coding Quiz #40 by eniolw

View this thread on: hive.blogpeakd.comecency.com
· @eniolw ·
$16.42
My Coding Quiz #40
<div class="text-justify">

<center><h2>My Coding Quiz #40 馃懆鈥嶐煉火煕狅笍馃З</h2></center>

<p>Welcome to the new installment of my series of <b>Coding Quizzes</b>, 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 <a href="/@eniolw">my blog</a> here on Hive and the <a href="/@eniolw/my-coding-quiz-1">first post</a> where I introduced it.</p>

<h3>Without further ado, here's the riddle...</h3>

<br>
<center>
<img src="https://images.ecency.com/DQmafcRPorsNmBMiZdPW3BZc18qSLua45aWqWAQcJJeS6RR/imagen.png" alt="Quiz">
<h6>By @eniolw</h6>
</center>

<br><center><h3>What's your choice? Can you figure out any feedback to the developers from this?</h3></center>

<p><b>Solution to the <a href="/@eniolw/my-coding-quiz-39">previous quiz</a>:</b> <b>a1,b2,c3,d4</b>. First of all, we define the string <code>files</code> with the hardcoded value <code>'abcd'</code> and the range <code>ranks</code> that goes from 1 to 5 (6 is not counted, since the limit of the range is exclusive).</p>

<p>Next, we create a <code>sq</code> object using the built-in <code>zip</code> function. This function allows you to loop over two or more iterables simultaneously and make a new iterable of tuples with the matching elements of each iterable. We can see how this works in the following table:</p>

<table>
<tr><td>Index</td><td><sub>0</sub></td><td><sub>1</sub></td><td><sub>2</sub></td><td><sub>3</sub></td></tr>
<tr><td>files</td><td>a</td><td>b</td><td>c</td><td>d</td></tr>
<tr><td>ranks</td><td>1</td><td>2</td><td>3</td><td>4</td></tr>
<tr><td>zip</td><td>a1</td><td>b2</td><td>c3</td><td>d4</td></tr>
</table>

<br><p>Interestingly, it seems that there is no mathematical function that describes this operation, since the <i>Catersian product of sets</i> differs in that it creates all possible pair of elements. According to <a href="https://math.stackexchange.com/questions/3337510/how-can-i-represent-the-haskell-python-etc-zip-function-in-math-notation">this page</a>, the <i>diagonal product</i> is a close approximation to the <code>zip</code> function.</p>

<p>Regardless, this function is very useful in programming and has many applications. In this case, I used it to combine the <code>files</code> and <code>ranks</code> to create <code>sq</code>, which stands for squares. If you pay attention, these are names of squares on a chess board: <b>a1</b>, <b>b2</b>, <b>c3</b> and <b>d4</b>.</p>

<p>Now, you may have also noticed that <code>ranks</code> had elements from <b>1</b> to <b>5</b>, so what happened to <b>5</b>? It was ignored because <code>zip</code> only pairs or combines iterables that have the same length. The moment the size of an iterable is longer than the others, <code>zip</code> will stop and the resulting iterable will have the same length as the shortest given iterable.</p>

<p>Finally, the iterable is executed using the well-known <code>join</code> function, obtaining a convenient string <code>labels</code>.</p>

<hr>

<p>If you want to blog about computer science and programming content, I invite you to join <a href="/">Hive</a> and participate in its communities, such as <a href="/created/hive-196387">STEM-social</a>, <a href="/created/hive-154226">Develop Spanish</a>, <a href="/created/hive-169321">Programming & Dev</a></p>

<hr>

<center><h2>Mi Quiz de Programaci贸n #40 馃懆鈥嶐煉火煕狅笍馃З</h2></center>

<p>Bienvenido a mi nueva serie de <b>Quizzes de Programaci贸n</b>, 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 <a href="/@eniolw">mi blog</a> aqu铆 en Hive y el <a href="/@eniolw/my-coding-quiz-1">primer post</a> donde la present茅.</p>

<h3>Sin m谩s pre谩mbulos, he aqu铆 el acertijo...</h3>

<br>
<center>
<img src="https://images.ecency.com/DQmdF6Dvuori34EpNnvhbJqK6VDyfe2tmTq1zydVUaijdqf/imagen.png" alt="Quiz">
<h6>Por @eniolw</h6>
</center>

<br><center><h3>驴Cu谩l es tu elecci贸n? 驴Puedes deducir alg煤n feedback a los desarrolladores a partir de esto?</h3></center>

<p><b>Soluci贸n al <a href="/@eniolw/my-coding-quiz-39">quiz anterior</a>:</b> <b>a1,b2,c3,d4</b>. En primer lugar, definimos la cadena <code>files</code> con el valor codificado <code>'abcd'</code> y el rango <code>ranks</code> que va del 1 al 5 (6 es no contabilizado, ya que el l铆mite del rango es excluyente).</p>

<p>A continuaci贸n, creamos un objeto <code>sq</code> usando la funci贸n <code>zip</code> incorporada. Esta funci贸n le permite recorrer dos o m谩s iterables simult谩neamente y crear un nuevo iterable de tuplas con los elementos coincidentes de cada iterable. Podemos ver c贸mo funciona esto en la siguiente tabla:</p>

<table>
<tr><td>脥ndice</td><td><sub>0</sub></td><td><sub>1</sub></td><td><sub>2</sub></td><td><sub>3</sub></td></tr>
<tr><td>files</td><td>a</td><td>b</td><td>c</td><td>d</td></tr>
<tr><td>ranks</td><td>1</td><td>2</td><td>3</td><td>4</td></tr>
<tr><td>zip</td><td>a1</td><td>b2</td><td>c3</td><td>d4</td></tr>
</table>

<br><p>Curiosamente, no parece que exista alguna funci贸n matem谩tica que describa esta operaci贸n, ya que el <i>producto catersiano de conjuntos</i> se diferencia en que crea todos los pares de elementos posibles. Seg煤n <a href="https://math.stackexchange.com/questions/3337510/how-can-i-represent-the-haskell-python-etc-zip-function-in-math-notation">esta p谩gina </a>, el <i>producto diagonal</i> es una aproximaci贸n cercana a la funci贸n <code>zip</code>.</p>

<p>De todos modos, esta funci贸n es muy 煤til en programaci贸n y tiene muchas aplicaciones. En este caso, lo us茅 para combinar los <code>files</code> y los <code>ranks</code> para crear <code>sq</code>, que significa casillas (squares en ingl茅s). Si prestas atenci贸n, estos son los nombres de las casillas de un tablero de ajedrez: <b>a1</b>, <b>b2</b>, <b>c3</b> y <b>d4</b>.</p>

<p>Ahora, tambi茅n habr谩s notado que <code>ranks</code> ten铆a elementos del <b>1</b> al <b>5</b>, entonces, 驴qu茅 pas贸 con <b>5</b>? Se ignor贸 porque <code>zip</code> solo empareja o combina iterables que tienen la misma longitud. En el momento en que el tama帽o de un iterable sea m谩s largo que los dem谩s, <code>zip</code> se detendr谩 y el iterable resultante tendr谩 la misma longitud que el iterable m谩s corto dado.</p>

<p>Finalmente, el iterable se ejecuta utilizando la conocida funci贸n <code>join</code>, obteniendo una conveniente cadena <code>labels</code>.</p>

<hr>

<p>Si quieres bloguear sobre contenido inform谩tico y de programaci贸n, te invito a unirte a <a href="/">Hive</a> y participar en sus comunidades, tales como <a href="/created/hive-196387">STEM-social</a>, <a href="/created/hive-154226">Develop Spanish</a>, <a href="/created/hive-169321">Programming & Dev</a> y otras.</p>

</div>
馃憤  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 493 others
properties (23)
authoreniolw
permlinkmy-coding-quiz-40
categoryhive-139531
json_metadata"{"image":["https://images.ecency.com/DQmafcRPorsNmBMiZdPW3BZc18qSLua45aWqWAQcJJeS6RR/imagen.png","https://images.ecency.com/DQmdF6Dvuori34EpNnvhbJqK6VDyfe2tmTq1zydVUaijdqf/imagen.png"],"tags":["hive-139531","programming","coding","python","quiz","hive","neoxian","proofofbrain","creativecoin","spanish"],"description":"My Coding Quiz #40 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 fun way.","app":"ecency/3.0.37-vision","format":"markdown+html","image_ratios":["0.9259","0.9259"]}"
created2024-01-20 04:53:18
last_update2024-01-20 04:53:18
depth0
children3
last_payout2024-01-27 04:53:18
cashout_time1969-12-31 23:59:59
total_payout_value8.254 HBD
curator_payout_value8.165 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6,850
author_reputation255,265,873,765,684
root_title"My Coding Quiz #40"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id130,623,653
net_rshares38,963,858,097,772
author_curate_reward""
vote details (557)
@esalcedo ·
@tipu curate 8 
properties (22)
authoresalcedo
permlinkre-eniolw-s7kedi
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.11.3"}
created2024-01-20 14:46:39
last_update2024-01-20 14:46:39
depth1
children1
last_payout2024-01-27 14:46:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length15
author_reputation114,852,809,791,900
root_title"My Coding Quiz #40"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id130,633,769
net_rshares0
@tipu ·
<a href="https://tipu.online/hive_curator?esalcedo" target="_blank">Upvoted  &#128076;</a> (Mana: 0/69) <a href="https://peakd.com/hive/@reward.app/reward-app-quick-guide-updated" target="_blank">Liquid rewards</a>.
properties (22)
authortipu
permlinkre-re-eniolw-s7kedi-20240120t144648z
categoryhive-139531
json_metadata"{"app": "beem/0.24.26"}"
created2024-01-20 14:46:48
last_update2024-01-20 14:46:48
depth2
children0
last_payout2024-01-27 14:46:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length215
author_reputation55,921,946,728,577
root_title"My Coding Quiz #40"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id130,633,772
net_rshares0
@stemsocial ·
re-eniolw-my-coding-quiz-40-20240120t235923719z
<div class='text-justify'> <div class='pull-left'>
 <img src='https://stem.openhive.network/images/stemsocialsupport7.png'> </div>

Thanks for your contribution to the <a href='/trending/hive-196387'>STEMsocial community</a>. Feel free to join us on <a href='https://discord.gg/9c7pKVD'>discord</a> 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.&nbsp;<br />&nbsp;<br />
</div>
properties (22)
authorstemsocial
permlinkre-eniolw-my-coding-quiz-40-20240120t235923719z
categoryhive-139531
json_metadata{"app":"STEMsocial"}
created2024-01-20 23:59:24
last_update2024-01-20 23:59:24
depth1
children0
last_payout2024-01-27 23:59:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length565
author_reputation22,918,491,691,707
root_title"My Coding Quiz #40"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id130,644,219
net_rshares0