Python is a widely used general-purpose, high-level programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code. The language provides constructs intended to enable clear programs on both a small and large scale.
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 uuid, random, json | |
# json.dumps(x, indent=4) | |
product_range = range(100000,110000) | |
num_recs_per_type = 20 | |
num_users = 500000 | |
user_ids = [ str(uuid.uuid1()) for _ in range(num_users) ] | |
rec_types = ['by_x','by_y','by_z'] |
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 WebScraper | |
def execute | |
create_folders | |
download_data | |
parse_data | |
write_output | |
end | |
def create_folder |
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
# This gist is a continuation of a previous gist which defines the MorningAlgorithm class | |
# https://gist.github.com/jpotts18/1f4269c9e1f22c963a0d | |
class LateMorningAlgorith < MorningAlgorithm | |
def work_out | |
puts "Nope..." | |
end | |
def eat_breakfast |
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 MorningAlgorithm | |
# This method is used to encapsulate the algorithm's general process. | |
# Notice this method is not concerned how the methods are accomplished | |
def execute | |
wake_up | |
workout | |
eat_breakfast | |
drive_to_work | |
end |
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 json, urllib2, re, csv | |
import xml.etree.ElementTree as ET | |
patterns = { | |
'YEAR': re.compile('(19|20)\d{2}'), | |
'ZIP': re.compile('(\d{5})'), | |
'MILES': re.compile('\d+,?(\d|X|k)+\smiles') | |
} | |
occurrences = { |
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
package com.verdad.core; | |
import android.content.Context; | |
import com.google.gson.FieldNamingPolicy; | |
import com.google.gson.Gson; | |
import com.google.gson.GsonBuilder; | |
import java.util.HashMap; | |
import java.util.Map; |
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 PizzaFactory | |
def self.create_pizza(type) | |
if type == 'Pepperoni' | |
return PepperoniPizza.new | |
if type == 'Greek' | |
return GreekPizza.new | |
end | |
end | |
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
########################### | |
# Identify the question | |
########################### | |
Identify the question you are trying to solve | |
# Which car is the most undervalued? | |
# Are we trying to maximize or minimize a variable? | |
########################### | |
# Understand the data |
- Github Wiki
- Markdown
What it is? Why its important? When is it used? - In the wild How to implement it? - Single file demo
- Data Structures - http://www.amazon.com/Cracking-Coding-Interview-Programming-Questions/dp/098478280X - Byron