Re: [pyar] ¿If anidado?

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

Responder a este mensaje
Autor: Roberto Alsina
Fecha:  
A: pyar
Asunto: Re: [pyar] ¿If anidado?
On Wednesday 16 September 2009 12:57:41 Juan Pedro Fisanotti wrote:
> Para agregarle un chiche, sería más lindo si cuando pones cualquier
> cosa, te deje volver a ingresarlo.
> Se me ocurre así, pero es bien a la python-way?:
>
> edad = raw_input("¿Cuantos años tenes?")
>
> while not edad.isdigit():
> print "No ingresaste un nro!"
> edad = raw_input()
>
> print "tenes %s años" % edad


Hmmmm

while True:
    edad=raw_input('¿Cuantos años tenes?')
    if edad.isdigit():
        break
    print 'No ingresaste un numero!'

Pero no tengo el pythonometro a mano ;-)

-- 
 ("\''/").__..-''"`-. .         Roberto Alsina
 `9_ 9  )   `-. (    ).`-._.`)  KDE Developer (MFCH)
 (_Y_.)' ._   ) `._`.  " -.-'  http://lateral.netmanagers.com.ar 
  _..`-'_..-_/ /-'_.'     The 6,855th most popular site of Slovenia   
(l)-'' ((i).' ((!.'       according to alexa.com (27/5/2007) 


---------------------------------------------------------------------
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/