Skip to content

Instantly share code, notes, and snippets.

def combination (n, m):
combs = [(x, y) for x in range() for y in range(m) if x != y]
#combs.extend([(x, y) for x in range(m) for y in range(n) if x != y])
for comb in combs:
print(comb, end='\n')
combination(3, 5)
def fib(n):
a, b = 0, 1
while b < n:
print (b, end=', ')
a, b = b, a+b
print()
fib (2000)
@chamix
chamix / app.js
Last active August 29, 2015 14:01
Node modules 1 chamix blog post
var miJuego= require('./juego');
console.log('juego id: ' + miJuego.juego.id +
'Jugadores: ' + miJuego.juego.jugadores[0] +
', ' + miJuego.juego.jugadores[1]);
function car(model, year, color){
this.model=model;
this.color=color;
this.year=year;
};
car.prototype.getInfo= function(){
return this.model + " | " + this.year + " | " + this.color;
};
function car(model, year, color){
this.model=model;
this.color=color;
this.year=year;
this.getInfo=getcarInfo;
};
function getCarInfo(){
return this.model + " | " + this.year + " | " + this.color;
};
@chamix
chamix / JSCreateClass1
Created October 27, 2013 00:11
This is one way to create a class in JavaScript
function car(model, year, color){
this.model=model;
this.color=color;
this.year=year;
this.getInfo=function(){
return this.model + " | " + this.year + " | " + this.color;
};
};