Skip to content

Instantly share code, notes, and snippets.

View JackInTaiwan's full-sized avatar

Jack Cheng JackInTaiwan

View GitHub Profile
import abc
class Dog(metaclass=abc.ABCMeta):
@abc.abstractmethod
def eat_shit(self):
return NotImplemented
@abc.abstractmethod
def pee(self):
import abc
class Dog(metaclass=abc.ABCMeta):
base = "Animal"
@abc.abstractmethod
def eat_shit(self):
return NotImplemented
def solution(input, k):
storage_dict = dict()
storage_dict[0] = [len(input) - 1]
current_index, prev_index = 0, None
input.append(-float("inf"))
for i in range(k - 1):
left_index = (current_index + 1) * 2 - 1
right_index = left_index + 1
def print_func_name(func):
def warp_1():
print("Now use function '{}'".format(func.__name__))
func()
return warp_1
def print_time(func):
import time
def warp_2():
def print_func_name(func):
def warp_1():
print("Now use function '{}'".format(func.__name__))
func()
return warp_1
def print_time(func):
import time
def warp_2():
class Dog:
def __init__(self, func):
self.age = 10
self.talent = func
def bark(self):
print("Bark !!!")
@Dog
def dog_can_pee():
class Dog:
def __init__(self, func):
self.talent = func
def bark(self):
print("Bark !!!")
@Dog
def dog_can_pee():
def print_func_name(func):
def wrap():
print("Now use function '{}'".format(func.__name__))
func()
return wrap
def dog_bark():
print("Bark !!!")
def dog():
height = 40
def profile():
print("I'm a dog and my height is {}.".format(height))
return profile
def dog():
height = 40
def grow_up():
height = height + 1
return grow_up
if __name__ == "__main__":