Skip to the content ForoHackers
Log inJoin

Python me anunció dos veces que no había bombo y luego encontró el bombo

Computer science educationDebuggingPython
#17607 · · Quote · Report

en mi lista ["caja","aro","bombo"] busco el primer bombo. en cada vuelta hago if golpe == "bombo": imprimo el sitio y break. al else de ese if le puse "no hay". el programa me anunció solemnemente DOS veces que no había antes de encontrarlo. es igual que mi viejo buscando las llaves.

#17748 · · Quote · Report

jaja @DalePorAhi, el else se lo has puesto a la pregunta por un golpe concreto. ¿cuándo podés decir que no hay ninguno en toda la lista?

#17749 · · Quote · Report

al final si no corté. me habían dicho que en Python se le podía poner else al for y lo tomé por una joda de esas que mandan a los nuevos a comprar agua en polvo.

#17750 · · Quote · Report

En este caso encaja. Alinea el else con el for. Entras en ese bloque cuando el bucle termina sin ejecutar break, también si la lista estaba vacía.

#17751 · · Quote · Report

probé las tres. bombo al final: sólo posición 2. sólo caja y aro: un "no hay". lista vacía: también "no hay", que era la que con mi primer dibujo no decía ni mu. la banda ha recuperado la fe en el bombo.

#17752 · · Quote · Report

my dad also finds the keys, then keeps looking. takes him about a minute to get out of the loop.

#17753 · · Quote · Report

lo de agua en polvo me lo apunto, che. con mi suerte me devuelven una bolsa de hielo.

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply