My Coding Quiz #30

in FreeCompliments7 months ago

My Coding Quiz #30 👨‍💻🛠️🧩

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: True. This quiz is no mystery and is basically a nod to the previous edition, which dealt with passing by reference.

We start by defining a local variable var and then a function func that takes a parameter also called var and modifies it inside. When the function func is called on line 4, the previously created local variable var, whose value is True, is passed to it. After returning from the function, the value of var remains True because it was a copy pass, that is, both var variables are different.

As for the semicolons in the script, they are completely unusual in Python, but not invalid, so they do not generate a syntax error. In fact, they can prove useful if you want to write several instructions on the same line.


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 #30 👨‍💻🛠️🧩

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: True. Este quiz no es ningún misterio y básicamente es un guiño a la edición anterior, que trataba del paso por referencia.

Comenzamos definiendo una variable local var y luego una función func que toma un parámetro también llamado var y lo modifica en su interior. Cuando la función func es llamada en la línea 4, se le pasa la variable local var previamente creada, cuyo valor es True. Tras regresar de la función, el valor de var se mantiene en True por cuanto fue un pase de copia, es decir, ambas variables var son diferentes.

En cuanto a los puntos y coma en el script, son completamente inusuales en Python, pero no inválidos, por lo que no generan error de sintaxis. De hecho, pueden probar su utilidad si quieres escribir varias instrucciones en una misma línea.


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:  

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. 
 

The Python code attempts to find a forward ("/") in the said URL string. If a match is found, it will print <class 're.Match'>, indicating a successful match; otherwise it will print <class 'NoneType'>, indicating no match.

Fair description. Almost like an AI would put it :)

def greet_and_introduce(Eniolw):
print(f"Hello {Eniolw}, AI Splash this side.")
print("It's amazing to meet you here in hive.")
print("You'll be amazed to see my CPU power.")
print("But not today ;)")

Opción D (class 're.Match')

Ok, veremos la respuesta correcta en la siguiente entrega.