This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*-coding: utf-8 -*- | |
import re | |
string = "aaaeijfdfsafdo" | |
Resultado= re.sub("^aa.+o$", "u", string) | |
print Resultado |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#coding: utf-8 | |
print "This is a snippet test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
for numero in range(2,100): | |
for divisor in range(2,numero): | |
if numero % divisor == 0: | |
print numero, 'es múltiplo de', divisor, 'y', numero/divisor | |
break | |
else: | |
print numero, 'es un número primo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# coding: UTF-8 | |
# Esto es un entero | |
Entero = 2000 | |
#Convertimos a Cadena | |
Cadena= str(Entero) | |
print type(Entero) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
try: | |
resultado = dividendo/divisor | |
except ZeroDivisionError: | |
print "No puedes dividir por cero, animal" | |
except ValueError: | |
print "Hay que ser bruto: eso no es un número" | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instruccion_Principal { | |
instruccion_anidada | |
} | |
instruccion_independiente |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instruccion_Principal: | |
instruccion_anidada | |
instruccion_independiente |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
for numero in range(2,100): | |
for divisor in range(2,numero): | |
if numero % divisor == 0: | |
print numero, 'es múltiplo de', divisor, 'y', numero/divisor | |
break | |
else: | |
print numero, 'es un número primo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#coding: utf-8 | |
Nombre1= raw_input("Escribe tu nombre: ") | |
if Nombre1 == "": | |
print "¡No has escrito nada!" | |
elif Nombre1 == "Psicobyte": | |
print "¡Qué nombre tan chulo! ¿Eres hacker o algo así?" | |
elif Nombre1 == "Python" or Nombre1 == "python": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#coding: utf-8 | |
def Saluda(nombre): | |
if nombre == "": | |
print "¡No has escrito nada!" | |
elif nombre == "Psicobyte": | |
print "¡Qué nombre tan chulo! ¿Eres hacker o algo así?" | |
elif nombre == "Python" or nombre == "python": | |
print "Tienes nombre de lenguaje de programación" |
OlderNewer