create account

My Coding Quiz #9 by eniolw

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

<center><h2>My Coding Quiz #9 👨‍💻🛠️🧩</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/DQmW3keobq9KAixDJybrLq6U5EZ98dfLRPDcvPG6rKkupXe/quiz_img_en.png" alt="Quiz">
<h6>By @eniolw</h6>
</center>

<br><center><h3>What's your choice?</h3></center>

<p><b>Solution to the <a href="/@eniolw/my-coding-quiz-8">previous quiz</a>:</b> <b>25</b>. Line 1 defines a list, which is entirely made up of numeric elements. This is good because they can be sorted. The sorting is carried out in the next line using the already known <code>sort</code> function, with the particularity that we specify that it sorts in the opposite direction by means of the argument <code>reverse=True</code>. Therefore, the list <code>b</code> is equal to <b>[5, 3, 1, 0, -1]</b>.</p>

<p>We then apply the <code>pop</code> method to list <code>b</code>, which allows us to remove the element of the list whose index we specify, modifying the list. As we specified <code>pop(1)</code>, the element at index 1, whose value is <b>3</b>, will be removed. That value is returned by <code>pop</code> and assigned to the variable <code>c</code>.</p>
    
<p>Finally, we get the values and solve the arithmetic of line 4:</p>

<ol>
<li><code>sum(a)</code> is the sum of the elements of list <code>a</code>, which is <b>8</b>.</li>
<li><code>sum(b)</code> is the sum of the elements of list <code>b</code>, which is <b>5</b>.</li>
<li><code>len(b)</code> is the length of <code>b</code>, which is <b>4</b>. Remember that one element was removed from it.</li>
<li><code>c</code> is <b>3</b>.</li>
</ol>

<p>Therefore, we have that <b>8 + 5 + 4 * 3</b> equals <b>25</b>, which is the snippet output.</p>

<p>Did you know about the <i>reverse</i> parameter and the <i>pop</i> method? It seems that @splash-of-angs63 did, since he managed to solve this puzzle!</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>,  <a href="/created/hive-153850">Hive Learners</a> and others.</p>

<hr>

<center><h2>Mi Quiz de Programación #9 👨‍💻🛠️🧩</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/DQmVb6dD91a81bwEZcP6Fxdgi7H9k2mjJkgx3vu295iYNP7/quiz_img_es.png" alt="Quiz">
<h6>Por @eniolw</h6>
</center>

<br><center><h3>¿Cuál es tu elección?</h3></center>

<p><b>Solución al <a href="/@eniolw/my-coding-quiz-8">quiz anterior</a>:</b> <b>25</b>. La línea 1 define una lista, que se compone enteramente de elementos numéricos. Esto es bueno porque se pueden ordenar. La ordenación se realiza en la siguiente línea utilizando la ya conocida función <code>sort</code>, con la particularidad de que especificamos que ordene en sentido contrario mediante el argumento <code>reverse=True</code>. Por tanto, la lista <code>b</code> es igual a <b>[5, 3, 1, 0, -1]</b>.</p>

<p>A continuación, aplicamos el método <code>pop</code> a la lista <code>b</code>, que nos permite eliminar el elemento de la lista cuyo índice especifiquemos, modificando la lista. Como especificamos <code>pop(1)</code>, se eliminará el elemento en el índice 1, cuyo valor es <b>3</b>. Ese valor es devuelto por <code>pop</code> y asignado a la variable <code>c</code>.</p>
    
<p>Finalmente, obtenemos los valores y resolvemos la aritmética de la línea 4:</p>

<ol>
<li><code>sum(a)</code> es la suma de los elementos de la lista <code>a</code>, que es <b>8</b>.</li>
<li><code>sum(b)</code> es la suma de los elementos de la lista <code>b</code>, que es <b>5</b>.</li>
<li><code>len(b)</code> es la longitud de <code>b</code>, que es <b>4</b>. Recuerda que se eliminó un elemento.</li>
<li><code>c</code> es <b>3</b>.</li>
</ol>

<p>Por lo tanto, tenemos que <b>8 + 5 + 4 * 3</b> es igual a <b>25</b>, que es el resultado del snippet.</p>

<p>¿Sabías sobre el parámetro <i>reverse</i> y el método <i>pop</i>? ¡Parece que @splash-of-angs63 lo hizo, ya que logró resolver este rompecabezas!</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>, <a href="/created/hive-153850">Hive Learners</a> y otras.</p>

</div>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 518 others
properties (23)
authoreniolw
permlinkmy-coding-quiz-9
categoryhive-196387
json_metadata"{"image": ["https://images.ecency.com/DQmW3keobq9KAixDJybrLq6U5EZ98dfLRPDcvPG6rKkupXe/quiz_img_en.png", "https://images.ecency.com/DQmVb6dD91a81bwEZcP6Fxdgi7H9k2mjJkgx3vu295iYNP7/quiz_img_es.png"], "thumbnails": ["https://images.ecency.com/DQmW3keobq9KAixDJybrLq6U5EZ98dfLRPDcvPG6rKkupXe/quiz_img_en.png", "https://images.ecency.com/DQmVb6dD91a81bwEZcP6Fxdgi7H9k2mjJkgx3vu295iYNP7/quiz_img_es.png"], "tags": ["hive-196387", "python", "coding", "programming", "quiz", "technology", "neoxian", "proofofbrain", "waivio", "spanish"], "description": "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.", "app": "ecency/3.0.35-vision", "format": "markdown+html"}"
created2023-07-22 11:00:51
last_update2023-07-22 11:00:51
depth0
children3
last_payout2023-07-29 11:00:51
cashout_time1969-12-31 23:59:59
total_payout_value4.776 HBD
curator_payout_value4.672 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,375
author_reputation253,497,814,325,855
root_title"My Coding Quiz #9"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id125,537,622
net_rshares20,072,932,230,084
author_curate_reward""
vote details (582)
@splash-of-angs63 ·
Since w=4, x is basically the string '8' obtained from multiplying w by 2. Multiplying the string by 3 gives us y which comes out to be '888'. z creates another list by repeating y twice. Thus Z = ['888','888']
properties (22)
authorsplash-of-angs63
permlinkre-eniolw-2023722t191515546z
categoryhive-196387
json_metadata{"tags":["hive-196387","python","coding","programming","quiz","technology","neoxian","proofofbrain","waivio","spanish"],"app":"ecency/3.0.35-vision","format":"markdown+html"}
created2023-07-22 13:45:15
last_update2023-07-22 13:45:15
depth1
children1
last_payout2023-07-29 13:45:15
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_length210
author_reputation49,712,805,563,209
root_title"My Coding Quiz #9"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id125,540,813
net_rshares0
@eniolw ·
Thanks for participating. We'll see about your answer in the next installment :)
properties (22)
authoreniolw
permlinkre-splash-of-angs63-2023724t155910532z
categoryhive-196387
json_metadata{"tags":["hive-196387","python","coding","programming","quiz","technology","neoxian","proofofbrain","waivio","spanish"],"app":"ecency/3.0.35-vision","format":"markdown+html"}
created2023-07-24 19:59:12
last_update2023-07-24 19:59:12
depth2
children0
last_payout2023-07-31 19:59:12
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_length80
author_reputation253,497,814,325,855
root_title"My Coding Quiz #9"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id125,607,965
net_rshares0
@stemsocial ·
re-eniolw-my-coding-quiz-9-20230723t043732309z
<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-9-20230723t043732309z
categoryhive-196387
json_metadata{"app":"STEMsocial"}
created2023-07-23 04:37:33
last_update2023-07-23 04:37:33
depth1
children0
last_payout2023-07-30 04:37:33
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,903,711,652,468
root_title"My Coding Quiz #9"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id125,559,444
net_rshares0