This file contains hidden or 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
| ## Author: Mario Abarca (knkillname) | |
| ## Email: [email protected] | |
| ## Date: 25 Feb 2015 | |
| ## Language: Python 3 | |
| ## | |
| ## Summary: A class representing bigraph objects given by a quasi-Cartan | |
| ## Matrix. Includes elementary operations, csv formating, and ploting. | |
| from array import array | |
| from os.path import splitext |
This file contains hidden or 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 ast | |
| ## ESTRUCTURA DE DATOS PARA ALMACENAR UN CIRCUITO BOOLEANO | |
| class Nodo: | |
| __slots__ = 'etiqueta', 'hijos' | |
| def __init__(self, etiqueta, *hijos): | |
| self.etiqueta = etiqueta | |
| self.hijos = hijos |
This file contains hidden or 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
| # This program prints all the programs that can be written in Python | |
| # (even this very same program if you give it enough time) | |
| import string | |
| def generate_programs(alphabet = string.printable): | |
| alphabet = tuple(alphabet) | |
| word, m, n = [], 0, len(alphabet) | |
| while True: | |
| p = ''.join(alphabet[i] for i in word) |
This file contains hidden or 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
| ## Algoritmos de caminos más cortos | |
| from estructuras import Cola, ColaMin | |
| from conectividad import ordenamiento_topologico | |
| inf = float('inf') #Tratar infinito como un numero | |
| def recorrido_a_lo_ancho(G, s): | |
| dist, padre = {v:inf for v in G}, {v:v for v in G} | |
| dist[s] = 0 |
This file contains hidden or 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
| ##Calculadora humana. Por knkillname. | |
| ##¡Diviértete! | |
| from random import choice, randint | |
| L = ['+', '-', '×', '/'] | |
| while True: | |
| op = choice(L) | |
| if op == '+': | |
| res = randint(1, 99) | |
| a = randint(0, res) |
NewerOlder