본문 바로가기

전체 글

(33)
[Codewars] Regex Password Validation ▶ 문제 : ▶ 내 답안 : 특수문자제거&대문자&소문자&숫자 regex = "^(?!(?=.*[!@#$^&%*()+=\_\-\[\]\\\/{}|:?,. ]).)(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9]).{6,}" ▶ 모범답안1 : regex = "^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])[^\W_]{6,}$" ▶ 모범답안2 : from re import compile, VERBOSE regex = compile(""" ^ # begin word (?=.*?[a-z]) # at least one lowercase letter (?=.*?[A-Z]) # at least one uppercase letter (?=.*?[0-9]) # at least one number [..
[Codewars] Car Park Escape Codewars: Achieve mastery through challenge Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com ▶ 문제 : ▶ 내 답안 : def escape(carpark): if carpark == [[0, 0, 0, 0, 2]] : return [] command = [] D = 1 i = 0 while i stai..
[Codewars] validDate Regex ▶ 문제 : ▶ 내 답안 : import re valid_date = re.compile(r"""(?!\[00-\d*\])(?!\[\d*-00\]) #00-dd, #dd-00 제거 (?!\[1[3-9]\d*-[0-3]\d*\]) (?!\[[0-1]\d*-3[2-9]\d*\]) (?!\[02-29\])(?!\[02-30\])(?!\[02-31\]) (?!\[04-31\])(?!\[06-31\])(?!\[09-31\])(?!\[11-31\]) (?!\[[0-1]\d*-3[2-9]\d*\]) # 32이상 제거 \[[0-1]\d*-[0-3]\d*\]""", re.VERBOSE) ▶ 모범답안 : import re # Months - Days valid_date = re.compile(r""" \[ (0[13578..
[근무일지] matplotlib 한글폰트 문제 1) 해결링크 ❤ [기타] Matplotlib 한글 폰트 설정 - Window 10 안녕하세요~ '꽁냥이'입니다. 제가 시각화 관련 포스팅을 진행하려고 하는데요. 근데 포스팅을 준비하다가 '이거는 사전에 미리 알려드려야겠다' 하는 것들이 생기더라고요. 이런 것들은 앞으로 zephyrus1111.tistory.com 2) 코드 해결방안 😉 # Data visualization import matplotlib as mpl from matplotlib import font_manager,rc import matplotlib.pyplot as plt %matplotlib inline # 폰트 경로 font_path = "C:/Windows/Fonts/NanumGothic.TTF" # 폰트 이름 얻어오기 font..
[근무일지] 주피터 노트북 커스텀 css 조정 jupyter notebook - custom csss 조정 ▼ Sample ▼ Code ▼ # .notebook_app > #header { box-shadow: 0px 0px 12px 1px rgba(87, 87, 87, 0.5); } .container { width: 1200px; max-width: 1200px; } div.CodeMirror, div.CodeMirror pre { /*코드 블록*/ font-family: D2Coding, Consolas; font-size: 17px; font-weight : 550; line-height: 140%;오후 3:33 2021-07-09 } .text_cell_render { /*마크다운*/ font-family: Roboto; font-size:..
[근무일지] 파이썬 라이브러리 3가지 에러 해결 (21.07.12.) 타임라인 07. 08(목) Ethernet(이더넷) 연결문제 발생 : 연결이 자꾸 끊어짐. 해결방안 찾지못했고 C드라이브 포맷을 진행 07. 09(금) 자료나 코드는 백업해놨지만, 주피터노트북 분석환경은 백업하지 못함. 결과적으로 파이썬 라이브러리를 재설치해야했고, 그 과정에서 기존 라이브러리가 업데이트 되면서 충돌을 일으키거나 설치 중에 문제를 겪었던 라이브러리를 다시 설치할 때 또 같은 문제를 경험함. 1. 텍스트분석 - eunjeon Mecab, dicpath 설정 문제 https://joyhong.tistory.com/129 from eunjeon import Mecab tagger = Mecab(dicpath= "C:/mecab/mecab-ko-dic") >>> _mecab.py 106번 라인 ..
[Codewars] Sine, cosine and others ▶ 문제 : 사인, 코사인, 탄젠트, 코탄젠트를 구하라 - value로 사인값이 주어진다. - list 안에 [ sin(사인), cos(코사인), tan(탄젠트), cot(코탄젠트) ] 값을 넣어 리턴하라. - 조건1) 모든 숫자는 2 demical place까지 반올림하라 (round) - 조건2) 탄젠트 or 코탄젠트 값을 계산할 수 없을 때는 리스트 안에 포함시키지 말 것. test.describe('Basic tests') test.assert_equals(sctc(1),[1, 0.0, 0.0]) test.assert_equals(sctc(1/2),[0.5, 0.87, 0.58, 1.73]) test.assert_equals(sctc(3 ** 0.5 / 2),[0.87, 0.5, 1.73, 0.5..
[Codewars] Double Every Other ▶ 문제 : ▶ 내 답안 : def increment_string(string): if string == "": return "1" try: if len(str(int(string)+1)) > len(string): return str(int(string) + 1) else: return "0"*(len(string) - len(str(int(string)+1))) + str(int(string)+1) except: for i, v in enumerate(string[::-1]): if v not in [str(x) for x in range(10)]: break org_str=string[:-i] if org_str == "" : return string + "1" else : org_num=strin..