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 pascal(c: Int, r: Int): Int = { | |
if(c == 0 || c == r) 1 else pascal(c, r-1) + pascal(c-1, r-1) | |
} |
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
#include <stdio.h> | |
int age(int* year); | |
int main() | |
{ | |
printf("Enter your birth year: "); | |
char buf[50]; | |
char* input = gets(buf); | |
int year = atoi(input); |
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 Stack: | |
def __init__(self): | |
self.values = [] | |
def push(self, x): | |
self.values.append(x) | |
def pop(self): | |
x = self.values[-1] |
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
<?xml version="1.0" encoding="UTF-8" ?> | |
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. --> | |
<!-- It contains information about your site's posts, pages, comments, categories, and other content. --> | |
<!-- You may use this file to transfer that content from one site to another. --> | |
<!-- This file is not intended to serve as a complete backup of your site. --> | |
<!-- To import this information into a WordPress site follow these steps: --> | |
<!-- 1. Log in to that site as an administrator. --> | |
<!-- 2. Go to Tools: Import in the WordPress admin panel. --> |
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
(defn abs [x] | |
(if (> x 0) x (* -1 x))) |
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
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
# | |
# xkcd.py | |
# | |
# xkcd comic grabber | |
from urllib2 import urlopen | |
from BeautifulSoup import BeautifulSoup |
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
#!/usr/bin/python2 | |
ex = [1, 2, 3, 4, 5, 6] | |
bs = 2 | |
def extract(lst, bs): | |
result = [] | |
for i in range(bs): | |
result.append(lst.pop()) | |
result.reverse() |
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 java.util.ArrayList; | |
import javax.swing.*; | |
public class Test{ | |
enum concentrations {MATH, SCIENCE, ENGLISH, WEB}; | |
public static void main(String[] args) { | |
ArrayList<String> names = new ArrayList<String>(); //stores student's names |
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 sys | |
files = ['lamp.txt', 'tv.txt', 'computer.txt'] | |
device_number = int(sys.argv[1]) | |
state = int(sys.argv[2]) | |
#checks if the device number given is valid. | |
def check_devnum(): | |
return 0 < device_number < 3 |
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
#include "stdafx.h" | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
int main() | |
{ | |
std::string input = "crap"; | |
std::vector<std::string> storage; | |