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
# do not change or move the following lines if you still want to use the box.py auto generator | |
from app import app, db | |
from models import Contact | |
# you can freely change the lines below | |
from flask import render_template | |
from flask import json | |
from flask import session | |
from flask import url_for | |
from flask import redirect |
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 merge_lists(left_sublist,right_sublist): | |
i,j = 0,0 | |
result = [] | |
#iterate through both left and right sublist | |
while i<len(left_sublist) and j<len(right_sublist): | |
#if left value is lower than right then append it to the result | |
if left_sublist[i] <= right_sublist[j]: | |
result.append(left_sublist[i]) | |
i += 1 | |
else: |
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
""" | |
Dasar pertama dalam mempelajari bahasa program adalah tipe data. | |
Pelajaran ini akan memberi pengetahuan mengenai variable dan tipe data pada python | |
""" | |
#Deklarasi Variable | |
var_none = None | |
#None merupakan pengganti null pada bahasa lain | |
var_integer = 1 | |
var_float = 1.1 |
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
#create the key-value object | |
class KeyValue: | |
def __init__(self,key,value): | |
self.key=key | |
self.value=value | |
class HashTable: | |
#initiate an empty list that will store all key value pair based on the KeyValue object | |
def __init__(self): |
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 quicksort(input_list): | |
higher = [] | |
lower = [] | |
if len(input_list) > 2: | |
pivot = (len(input_list) - 1)/2 | |
mid = [input_list[pivot]] | |
i = 0 | |
while i < len(input_list): | |
if i != pivot: | |
if input_list[i] <= input_list[pivot]: |
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
""" | |
crawler.py | |
web link crawler | |
Nov 3rd 2012 saturday night insomnia coding session | |
Fauzan Erich Emmerling | |
erich@emfeld.com | |
""" | |
import re | |
from urllib2 import urlopen |
NewerOlder