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
#eleccion.py | |
from random import shuffle, choice | |
# La funcion shuffle del modulo random puede revolver una lista de forma aleatoria | |
# La funcion choice escoje de forma aleatoria un elemento de una lista | |
if __name__ == "__main__": | |
print "+--------------------------------+" | |
print "! Sistema de eleccion !" | |
print "! Aleatoria !" |
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
#eleccion.py | |
""" | |
Este script soporta ser reiniciado varias veces, guardando los cambios cada vez | |
""" | |
from random import shuffle, choice | |
if __name__ == "__main__": | |
print "+--------------------------------+" |
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
#Lista de numeros primos entre 1 y 100 en una sola linea | |
c = [i for i in xrange(2,101) if (i%2!=0 or i==2) and (i%3!=0 or i==3) and (i%5!=0 or i==5) and (i%7!=0 or i==7)] | |
print c |
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
/* | |
* Este programa lee un numero entero positivo n y llena un arreglo | |
* con n elementos para luego ordenarlos usando el algoritmo quicksort | |
*/ | |
#include<iostream> | |
using namespace std; | |
void quicksort(int arreglo[], int inicio, int fin){ |
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
print(u'\xa1'+[{'foo': i, 'var': ['pez', 'rana', lambda a: (str(a), u'678hHola mundo!nguy')]} for i in ['a' in 'pan']][not True]['var'][2](1)[1][4:15]) #Jaque mate |
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
# http://search.twitter.com/search.json?q=query | |
#Juegos diversos con twitter | |
from urllib import urlopen | |
import json | |
from pprint import pprint | |
def busca_tweets(cadena): | |
result = urlopen("http://search.twitter.com/search.json?q=" + cadena) | |
tweets = json.loads(result.read()) | |
for tweet in tweets['results']: |
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
def inf(i=0, step=1): | |
#un generador de iteradores infinitos, como el xrange, pero infinito | |
while True: | |
yield i | |
i+=step | |
for i in inf(): | |
print i |
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
# Arhivo de experimentos con python | |
from random import choice | |
lista_palabras = { | |
'pollo': ['Es un ave que se come', 'Se hace caldo de esto'], | |
'verdura':['Son vegetales', 'Son verdes'], | |
'sal':['es un mineral'] | |
} |
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
import curses | |
from random import randrange | |
curses.initscr() | |
curses.curs_set(0) | |
win = curses.newwin(18,18,0,0) # Create window and draw border | |
win.keypad(1) | |
win.nodelay(1) | |
f = [ [0x315,0x4cd,0x13f,0xc47],[0x31d,0x4cf,0x137,0xc45],[0x374,0x374,0x374,0x374],[0x741,0x51c,0xdc3,0xf34], | |
[0xfc1,0x73c,0x543,0xd14],[0x311,0x4cc,0x133,0xc44],[0xc34,0x341,0x41c,0x1c3]] | |
def chkFig(crds,s): # collision detection |
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
head = document.getElementsByTagName("head")[0]; | |
s = document.createElement('script'); | |
s.setAttribute('src', 'http://localhost:83/jquery.js'); | |
head.appendChild(s); | |
//Con esto logramos inyectar jquery en un sitio web |
OlderNewer