Comparando Python 2.* y Python 3.* | Develop Site
Haciendo una comparacion en estas versiones de Python en scripts de ejemplos
raw_input e input
- Python 3.5
- >>> x = int(input("Please enter an integer: "))
- Please enter an integer: 42
- >>> if x < 0:
- ... x = 0
- ... print ("Negative changed to zero")
- ... elif x == 0:
- ... print ("Zero")
- ... elif x == 1:
- ... print ("Single")
- ... else:
- ... print ("More")
- ...
- More
- Python 2.6
- >>> x = int(raw_input("Please enter an integer: "))
- Please enter an integer: 42
- >>> if x < 0:
- ... x = 0
- ... print 'Negative changed to zero'
- ... elif x == 0:
- ... print 'Zero'
- ... elif x == 1:
- ... print 'Single'
- ... else:
- ... print 'More'
- ...
- More
Deja tu comentario o visita nuestras redes sociales:
Español
- blog de ernesto
- Log in or register to post comments