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
def has_duplicates(node, seen=None, duplicates=None): | |
if not seen: | |
seen = set([]) | |
if not duplicates: | |
duplicates = set([]) | |
if node: | |
if node.data in seen: | |
duplicates.add(node.data) |
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
def greedy_make_change(change, currency='American'): | |
if currency == 'American': | |
valid_coins = [1, 2, 5, 10, 25, 100, 200, 500, 1000, 2000] | |
elif currency == 'European': | |
valid_coins = [1, 2, 5, 10, 50, 100, 200, 500, 1000, 2000] | |
else: | |
raise ValueError("Invalid currency type.") | |
change_coins = {coin: 0 for coin in valid_coins} |
We can't make this file beautiful and searchable because it's too large.
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
id,algoritmo,balotaje1,balotaje2,coche1,coche2,coche3,edad,error,errorn,flauta1,flauta2,flauta3,genero,interes1,niveleducativo,of1,of2,ofcalculado,ofpresentado,omitirdatos,p1,p10,p11,p12,p2,p3,p4,p5,p6,p7,p8,p9,posiciones,rp1,rp1cambiar,rp2,rp2cambiar,rp3,rp3cambiar,rp4,rp4cambiar,rpc1,rpc2,rpc3,rpc4,seguridad1,seguridad2,ubicacion,vota,votoprimera,pregs_camb_1,pregs_camb_2,pregs_camb_3,pregs_camb_4,grupo | |
179,0,666,666,-999,-999,-999,25,-1,1,-999,-999,-999,32,NaN,205,88,100,78416666666667,40,-999,64,0,44,35,100,100,14,42,43,55,100,100,100,35,-1,40,-1,55,-1,60,1,86,100,92,45,100,100,-1,-999,666,12,9,7,6,3 | |
180,25,660,660,103,101,75,26,-1,1,103,102,74,31,NaN,206,36,40,49833333333333,60,1,24,35,62,73,78,62,33,85,73,64,100,31,64,78,-1,60,1,64,1,60,1,76,54,39,56,21,21,NaN,-999,NaN,2,4,7,10,2 | |
181,97,660,660,102,101,94,28,-1,1,102,101,99,31,NaN,205,98,98,NaN,60,1,0,0,100,0,0,95,99,99,100,99,98,100,88,99,-1,40,-1,100,-1,60,-1,99,96,98,94,97,97,NaN,-999,-1,5,7,11,12,2 | |
182,100,667,667,103,103,74,33,-1,1,103,102,78,32,Na |
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
library(plotrix) | |
STdata <- read.csv('~/cs112/STcongenero.csv') | |
# Variable set-up | |
bal1 <- STdata$balotaje1 | |
bal2 <- STdata$balotaje2 | |
rp1c <- STdata$rp1cambiar | |
rp2c <- STdata$rp2cambiar | |
rp3c <- STdata$rp3cambiar |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from collections import deque | |
class Symbol(object): | |
def __init__(self, value): | |
""" | |
A propositional symbol. |
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
class User(object): | |
def __init__(self, name, courses=[]): | |
self.name = name | |
self.courses = courses # Course instances | |
class Course(object): | |
def __init__(self, name, professor, students=[]): | |
self.name = name | |
self.students = students # User instances |
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 click | |
import i18n | |
import os | |
from itertools import product | |
from rand import random | |
TRANSLATIONS_FOLDER = os.path.dirname(__file__) or '.' + '/translations' | |
RNG_TYPE = 'mersenne' | |
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
from datetime import datetime | |
def random(generator_type, seed=None): | |
""" | |
Pseudorandom number generator (PRNG) factory using either RANDU or the | |
Mersenne Twister. | |
@param generator_type: One of ['mersenne', 'mersenne twister', 'randu'] | |
@param seed: Number used to initialize the PRNG (default: None) | |
@return: Pseudorandom number |
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
from template import AbstractSimulation | |
from random import choice | |
class Rule(AbstractSimulation): | |
def __init__(self, number_steps, num_cells, cells=None, rule=90): | |
super().__init__(number_steps) | |
self.num_cells = num_cells | |
self.cells = cells | |
self.rule = rule |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<meta name="theme-color" content="#000000"> | |
<!-- | |
manifest.json provides metadata used when your web app is added to the | |
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ | |
--> |
OlderNewer