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
print '***ROCK PAPER SCISSORS***' | |
pl1 = raw_input("Enter Player 1's choice (rock, paper or scissors): ") | |
pl1 = pl1.lower() # convert input into lower case | |
# Making sure the input is valid | |
if pl1 == 'rock' or pl1 == 'paper' or pl1 == 'scissors': | |
print 'Player 1: ' + pl1 | |
else: | |
print 'Invalid input' |
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
# 6.189 A Gentle Introduction to Programming | |
# Mechanical MOOC | |
# Exercise 1.8 | |
print '*****LOOPS*****' | |
# Task 1 | |
# prints out decimal equivalents of 1/2, 1/3, 1/4, ..., 1/10 | |
for i in range(2,11): | |
print 1.0/i |
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
complete <- function(directory, id = 1:332) { | |
nobs <- numeric(0) | |
source("getmonitor.R") | |
for (i in id) { | |
data <- getmonitor(i, "specdata") | |
numbers <- as.numeric(complete.cases(data)) | |
total <- sum(numbers) | |
nobs <- c(nobs, total) | |
} | |
result = data.frame(id = id, nobs = nobs) |
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
corr <- function(directory, threshold = 0) { | |
source("getmonitor.R") | |
source("complete.R") | |
all.cases <- complete("specdata", id = 1:332) | |
needed.cases <- subset(all.cases, all.cases$nobs > threshold) | |
result <- numeric(0) | |
id <- needed.cases$id | |
for (i in id) { | |
data <- getmonitor(i, "specdata") | |
crl <- cor(data$sulfate, data$nitrate, use = "pairwise.complete.obs") |
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
### Final Lending Club Analysis### | |
## This analysis was performed using Windows 7 and RStudio version 3.0.1 ## | |
# Download data | |
fileUrl <- "http://spark-public.s3.amazonaws.com/dataanalysis/loansData.csv" | |
download.file(fileUrl, destfile = "loansData.csv") | |
# Read data into R | |
loansData <- read.csv("loansData.csv") |
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 requests | |
from bs4 import BeautifulSoup | |
import urllib2 | |
import json | |
import csv | |
api = "http://api.readability.io/api/1.0/ru/measure/?url=http://government.ru" | |
url = "http://government.ru/meetings/" | |
url_for_dict = "http://government.ru" |
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
# -*- coding: utf-8 -*- | |
import requests | |
import csv | |
import time | |
csv_keys = ['region_code', 'year', 'summ_price', 'total_items', 'ave_price', 'total_contracts'] | |
def extract_values(lst, year, region_code): |
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
# -*- coding: utf-8 -*- | |
import requests | |
import csv | |
import time | |
def extract_values(target_api, lst, target_code): | |
raw = requests.get(target_api) | |
try: | |
data = raw.json() |
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
# -*- coding: utf-8 -*- | |
import requests | |
import csv | |
import time | |
def extract_values(target_api, lst): | |
raw = requests.get(target_api) | |
try: |
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
<!DOCTYPE html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
<link rel="stylesheet" href="https://rawgit.com/andrewgiessel/leafletstuff/master/leaflet.css" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> |
OlderNewer