Re: [pyar] ¿If anidado?

Página superior
Adjuntos:
+ (text/plain)
+ (text/html)

Responder a este mensaje
Autor: Manuel Aráoz
Fecha:  
A: pyar
Asunto: Re: [pyar] ¿If anidado?
qué tal esto?

get_edad = lambda: raw_input("Ingrese edad por favor: ")
edad = get_edad()
while not edad.isdigit():
print "No ingresaste un numero!"
edad = get_edad()


:D

2009/9/16 Facundo Batista <facundobatista@???>

> On Wed, Sep 16, 2009 at 2:30 PM, Manuel Aráoz <manuelaraoz@???>
> wrote:
>
> > mucho más lindo lo que propusieron de
> >
> > while not edad.isdigit():
> > print "No ingresaste un nro!"
> > edad = raw_input()
>
> El problema acá es que tenés dos veces el raw_input(), con lo cual si
> tenés que cambiar el mensaje tenés que tocar dos lados del código, y
> seguro que en algún momento te olvidás de uno y te queda desparejo...
>
> --
> . Facundo
>
> Blog: http://www.taniquetil.com.ar/plog/
> PyAr: http://www.python.org/ar/
>
> ---------------------------------------------------------------------
> Para dar de baja la suscripcion, mande un mensaje a:
> pyar-unsubscribe@???
>
> Para obtener el resto de direcciones-comando, mande un mensaje a:
> pyar-help@???
>
> PyAr - Python Argentina - Sitio web: http://www.python.com.ar/
>
>
>