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 httplib2 | |
import json | |
import sys | |
import codecs | |
sys.stdout = codecs.getwriter('utf8')(sys.stdout) | |
sys.stderr = codecs.getwriter('utf8')(sys.stderr) | |
# gapi_key="your key" | |
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 decToBinary(n): | |
mod = "" | |
n = int(n) | |
while n>0: | |
result = int(n/2) | |
mod = str(mod) + str(n%2) | |
n = int(result) | |
return mod | |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
void makepyramid(int n); | |
char * printSpaces(int n); | |
int main() | |
{ |
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
makePyramid(2); | |
function makePyramid(n) { | |
n = n *2+2; | |
r = parseInt(n/2) + 1; | |
for(var i=2;i<n;i+=2) { | |
// inject spaces before every hash line | |
// number of spaces r = n/2 + 1 | |
var z = (n-i)/2+1; | |
process.stdout.write(returnSpaces(z)); |