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
# hi |
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
class Mother: | |
my_varialbe = 3 | |
def _func(self): | |
print('func 호출') | |
def func_caller(self): | |
print('여기에 로그를 쓰면 됩니다: {}'.format(self.my_variable)) | |
self.func() | |
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
import dis | |
def recursive_sum(n): | |
print('recursive 호출', n) | |
if n == 1: | |
return 1 | |
return n + recursive_sum(n-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
def alter_alpha(to): | |
num = ord(to) | |
return num - 65 if num < 79 else 90 - num + 1 | |
def traverse(done, i): | |
# TODO ; left_cnt 보다 right_cnt 가 크면 right 탐색을 중단 하는 최적화가 가능할까? 답에 영향이 없을까? | |
# 기저 사례 | |
if False not in done: |
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
package buv.co.kr.util.youtube;/* | |
* Copyright (c) 2012 Google Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
* in compliance with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software distributed under the License | |
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
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
solution = lambda t, l = []: max(l) if not t else solution(t[1:], [max(x,y)+z for x,y,z in zip([0]+l, l+[0], t[0])]) |
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
# 종만북에서 풀었던 문제. 삼각형 모양만 다르다. | |
# cache[i][j] 보다 f 스트링을 사용한 1중 dict 가 훨씬 빠르다. | |
# 이게 반복으로 풀 수 있는 문제인가? | |
cache = {} | |
def move(triangle, i, j): | |
''' | |
현재 위치에서 내려갔을 떄 얻을 수 있는 최댓값을 반환합니다. |
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 solution(t, l = []): | |
if not t: # 탈출 조건. 삼각형을 전부 소모한다. | |
return max(l) | |
result = [] | |
for x, y, z in zip([0]+l, l+[0], t[0]): # [0] + l = 0 더하기 리스트 | |
# zip 은 리스트를 n 개 받아서 각 리스트 마다 foreach 를 돌아줘요 | |
# for a, b, c in zip(A, B, C) 이면 a 는 A의 요소, b 는 B의 요소, c 는 C의 요소 | |
result.append(max(x, y) + z) # result 에 하나씩 더함 |
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
import sys , os | |
sys.path.append(os.pardir) | |
from dataset.mnist import load_mnist | |
from common.functions import sigmoid, softmax, np | |
def get_data(): | |
(x_train, t_train), (x_test, t_test)=\ | |
load_mnist(normalize=True, flatten=True, one_hot_label=True) | |
return x_train, t_train |
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
#!/usr/bin/env python | |
import flask | |
from flask import request, jsonify | |
from os import path, environ | |
from raven.contrib.flask import Sentry | |
import cv2 | |
import numpy as np | |
import requests |
OlderNewer