My Coding Quiz #14

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@eniolw·
0.000 HBD
My Coding Quiz #14
<div class="text-justify">

<center><h2>My Coding Quiz #14 👨‍💻🛠️🧩</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/DQmW7Kqt58FHwCSnD8Afe9uFFXJbHcRyTYkAxbmcVqp1MeG/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-13">previous quiz</a>:</b> <b>SS</b>. Line 1 defines a string <code>a</code> with the content <code>" Science "</code>. Note the deliberate presence of whitespace at the beginning and end of the string.</p>

<p>Line 2 creates a <code>b</code> variable. To do this, first whitespace at the beginning and end of <code>a</code> is removed using the built-in <code>strip</code> method. A special slice is then applied using the <code>[::-1]</code> notation. This is another of many ways to create a reversed list in Python. The <code>-1</code> at the end indicates that the step should be done one at a time, but in reverse. In the end, the value of <code>b</code> will be <code>'ecneicS'</code>.</p>

<p>Line 3 creates a variable <code>c</code> with <code>a</code> and <code>b</code> elements accessed by indexes. We know that the element at index 1 of <code>a</code> has the value <b>'S'</b>, and it is not surprising that the element at index -1 of <code>b</code> corresponds to the last one, whose value is also <b>'S'</b>. The value of <code>c</code>, therefore, will be <b>'SS'</b>, which is printed at line 4.</p>

<p>Both @rafaelaquino and @jesalmofficial solved this quiz and @jesalmofficial even provided an explanation. Very good!</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 #14 👨‍💻🛠️🧩</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/DQmNU4Di9YRa8NZ3ZM3yxQUJMERMGMFHQaSzLovJVep26Xk/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-13">quiz anterior</a>:</b> <b>SS</b>. La línea 1 define una cadena de caracteres <code>a</code> con el contenido <code>" Science "</code>. Nótese la presencia deliberada de espacios en blanco al principio y final de la cadena.</p>

<p>La línea 2 crea una variable <code>b</code>. Para ello, primero se remueven los espacios en blanco al principio y al final de <code>a</code> usando el método incorporado <code>strip</code>. Luego se aplica un rebanado especial usando la notación <code>[::-1]</code>. Esta es otra de muchas maneras de crear una lista invertida en Python. El <code>-1</code> al final indica que el paso debe hacerse de uno en uno, pero en sentido contrario. Al final, el valor de <code>b</code> será <code>'ecneicS'</code>.</p>

<p>La línea 3 crea una variable <code>c</code> con elementos de <code>a</code> y <code>b</code> accedidos mediante índices. Sabemos que el elemento en el índice 1 de <code>a</code> posee el valor <b>'S'</b>, y no es una sorpresa que el elemento en el índice -1 de <code>b</code> corresponda al último, cuyo valor también es <b>'S'</b>. El valor de <code>c</code>, por tanto, será <b>'SS'</b>, lo impreso en la línea 4. </p>

<p>Tanto @rafaelaquino como @jesalmofficial resolvieron este quiz y @jesalmofficial incluso proveyó una explicación. ¡Muy bien!</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>
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,