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 io | |
import sys | |
import urllib | |
import bs4 | |
import requests | |
from PIL import Image | |
def get_image_list(url): | |
"""Given the url of an HTML document, return a list of urls of all images |
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 time | |
import urllib | |
import bs4 | |
import requests | |
start_url = "https://en.wikipedia.org/wiki/Special:Random" | |
target_url = "https://en.wikipedia.org/wiki/Philosophy" |
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
films = [('Brief Encounter', '1945'), | |
('Casablanca', '1942'), | |
('Before Sunrise', '1995'), | |
('Before Sunset', '2004'), | |
('Breathless', '1960'), | |
('In the Mood for Love', '2000'), | |
('The Apartment', '1960'), | |
('Hannah & Her Sisters', '1986'), | |
('Eternal Sunshine of the Spotless Mind', '2004'), | |
('Room With a View', '1985'), |
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 math | |
import requests | |
class GitHubRepo: | |
""" | |
A demonstration of iterables. | |
You can iterate over the commits made to a GitHub repo by iterating over | |
an instance of this class. |
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
P1 - Movie Trailer Website - Eduardo | |
# Project: Movie Trailer Website - [Author’s Name] | |
================================ | |
## Required Libraries and Dependencies | |
----------------------------------- | |
[In this section list your project’s dependencies. A basic Movie Website Trailer project requires Python v2.* to be installed] | |
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 fact(n): | |
result =1 | |
for i in range(1, n+1): | |
result *= i | |
return result |
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
{ | |
"retirementStartYear": 2014, | |
"retirementEndYear": 2043, | |
"portfolio": { | |
"initial": 8000, | |
"percentEquities": 75, | |
"percentBonds": 25, | |
"percentGold": 0, | |
"percentCash": 0, | |
"percentFees": 0, |
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 | |
import csv | |
from collections import Counter | |
from pprint import pprint | |
with open('./440801.csv') as f: | |
# data from | |
obs = [] | |
csv = csv.DictReader(f) | |
for line in csv: |
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 decimal import * | |
def count_ways(n, max_step_size=2): | |
table = [Decimal(1), Decimal(1), Decimal(2)] | |
assert len(table) >= max_step_size | |
for i in xrange(3,n+1): | |
table.append(sum(table[i-max_step_size:i])) | |
return table[n] |
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 matplotlib.pyplot as plt | |
import random | |
def binary_search(target, epsilon): | |
guess = 1.0 | |
bottom = 1.0 | |
top = float("inf") | |
steps = 0 | |
while abs(target-guess)>epsilon: |
NewerOlder