Skip to content

Instantly share code, notes, and snippets.

👀
Looking for inspirations

TC Liu liuderchi

Block or report user

Report or block liuderchi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View restaurant.py
'''restaurant.py
Designing some problems for
Intro to Computer Science Lesson 1 ~ Lesson 3 Review Question Code
Course Source: https://www.udacity.com/course/viewer#!/c-cs101
'''
menu = [ [ "大麥克" , "牛肉, 酸黃瓜, 起士" , 109 ],
[ "麥香魚" , "鱈魚, 起士, 美乃滋" , 99 ],
[ "麥香雞" , "雞肉, 生菜, 美乃滋" , 89 ] ]
@liuderchi
liuderchi / wk2-review.py
Created Nov 30, 2015
wk2-python-review
View wk2-review.py
def umbrella_check( p ):
if p > 50:
print 'remember your umbrella'
else:
print 'no need umbrella'
umbrella_check( 30 ) #no need umbrella
umbrella_check( 51 ) #remember your umbrella
def good_umbrella_check( p ):
View wk2-answers.py
'''題目1'''
weekdays = ['Mon','Tue','Wed','Thu','Fri']
def good_print_weekday( num, weekdays ):
if num > 5:
print 'index too large'
else:
print weekdays[ num - 1]
View wk3-q3.py
record = '''12.0 TOR Defensive Rebound by Terrence Ross
12.0 93-102 LAL D'Angelo Russell missed 3-pt. Jump Shot
25.0 93-102 TOR Cory Joseph made 2nd of 2 Free Throws
25.0 93-101 TOR Cory Joseph missed 1st of 2 Free Throws
25.0 LAL Personal foul on Kobe Bryant
39.0 93-101 LAL Kobe Bryant made 2nd of 2 Free Throws
39.0 92-101 LAL Kobe Bryant made 1st of 2 Free Throws
39.0 TOR Shooting foul on Bismack Biyombo
43.0 LAL Full Timeout
43.0 91-101 TOR Cory Joseph made 2nd of 2 Free Throws
View wk3-q1.py
menu = [ 25, 105, 38, 55, 110 ]
drink = [ 35, 88, 140 ]
def change_price( price ):
i = 0
while i < len(price):
if price[i] > 100:
price[i] = price[i] - 20
i = i + 1
return price
View wk3-q2.py
menu = [ 25, 105, 38, 55, 110 ]
drink = [ 35, 88, 140 ]
def change_price( price ):
result = []
for e in price:
if e > 100:
e = e - 20
result.append(e)
return result
View wk4-q1.py
mc_menu = [ ["Big Mac" , "beef, cucumber, cheese" , 109 ],
["Filet-O-Fish" , "fish, cheese, mayonnaise" , 99 ],
["McChicken" , "chicken, lettuce, mayonnaise" , 89 ] ]
def print_burger( menu ):
i = 0
while i < len( menu ) :
print ( menu[ i ][ 0 ] ) # print burger
print ( menu[ i ][ 2 ] ) # print price
@liuderchi
liuderchi / test_thread.py
Created Jan 27, 2016
test thread by Chou
View test_thread.py
#!/usr/bin/env python
from threading import Thread
import time
class Man(object):
def __init__(self):
self.switch = True
def stop(self):
self.switch = False
@liuderchi
liuderchi / line_sticker_printer.py
Last active Jan 28, 2016
crawl img in line store and download them. using beautifulsoup4
View line_sticker_printer.py
#!/usr/bin/env python3
# Web Crawler for line stickers
# USAGE:
# $ python line_sticker_printer.py <url>
# example url:
# https://store.line.me/stickershop/home/user/zh-Hant
# https://store.line.me/stickershop/home/general/zh-Hant
#
# credit:
# jminh@github and hour of code
View typhoon_dayoff_crawler.py
# coding=utf8
import urllib
import re
from bs4 import BeautifulSoup as BS
url = 'http://www.dgpa.gov.tw/'
html_content = urllib.urlopen(url).read()
soup_obj = BS(html_content, 'html.parser')
You can’t perform that action at this time.