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 random | |
def new_card(): | |
DEX = [1,2,3,4,5,6,7,8,9,10,'A','J','K','Q'] | |
card = DEX * 4 | |
random.shuffle(card) | |
return card | |
player_card = [] | |
dealer_card = [] |
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 reverse(move_list): | |
for x in move_list: | |
for i in range(len(x)): | |
if x[i]==2: | |
x[i]=3 | |
elif x[i]==3: | |
x[i]=2 | |
return move_list | |
def reverse2(move_list): |
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 recursive(total,coin,n): | |
for y in range(total//coin[n]+1): | |
if n==0: | |
if total % coin[0] == 0: | |
global count | |
count +=1 | |
break | |
else: | |
break | |
temp = total |
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
#이미지를 받아, 한가지 인자만 갖는 흑백 어레이 리턴 | |
##사이즈와 이미지 url을 받아, 이미지를 배열로 바꾼후, RGB 세인자를 적절한 계산을 통해 하나의 값으로 바꿔준다. | |
import numpy as np | |
def img_into_array(img_url,size) | |
img = Image.open(img_url) | |
img.thumbnail(size) | |
width,height = img.size | |
img_list = np.array(img).reshape(height,width,3) | |
img_gray = np.zeros((height,width),np.uint8) | |
# 이미지 배열을 흑백화 하는 과정 img = PIL.Image.open("foo.jpg").convert("L") |
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 numpy as np | |
def numpy_array_to_image(numpy_array) | |
img = Image.fromarray(numpy_array) | |
return img | |
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
# 이미지 내의 한줄로 구성된 문자들이 있을 경우 문자들을 구분해주는 흰 여백의 x좌표를 list로 반환한다. | |
def x_cordinate(url): | |
arr = image_into_array(url,(1000,1000)) | |
img = Image.open(url) | |
xcrop = [0] | |
satisfied = 0 | |
width,height = img.size | |
for y in range(width): | |
for x in range(height): | |
if arr[x][y] == 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
Homebrew build logs for homebrew/science/opencv3 on macOS 10.11.6 | |
Build date: 2017-03-03 01:14:37 |
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
value = [5,4,3,2,1] | |
1. bulit in functiond을 사용해 value의 값을 모두 없애시오. | |
2. a = value, value[1] = 10일 때 a[1]값과 | |
a = value.copy() value[1] = 10일 때 a[1]의 값은 같을까? | |
3. c = [3, -4, 5, -6, 7] 일 때 sort메소드를 사용하여 제곱값이 큰 작은 순서대로 정렬하시오. | |
4. a = {1,2,3,4,5}, b = {2,3,4,5,6}라고 주어졌다. | |
4-1 a.difference(b)의 값 {1,6}이다. True or False | |
4-2 a - b 와 a.difference_update(b)의 값은 같다. True or False | |
4-3 a.discard(6) 오류가 난다. True or False | |
4-4 a와 b의 공통 요소만 뽑아 새로운 list를 만들어 보시오. |
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 guess(guesses, n): | |
while(True): | |
guess2 = int(input("{}번째 수를 입력하세요".format(n))) | |
if guess2 not in range(10): | |
print("범위를 벗어나는 수입니다 다시 입력해주세요") | |
elif guess2 in guesses: | |
print("중복되는 수입니다. 다시 입력해주세요") | |
else: | |
guesses.append(guess2) | |
break |
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
from random import randint | |
numbers = [] | |
strike = 0 | |
count = 0 | |
# 세개 뽑을때까지 반복 | |
while len(numbers) < 3: | |
new_number = randint(0, 9) | |
# 새로운 수 나올때까지 다시 뽑기 |
OlderNewer