This file contains hidden or 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
    
  
  
    
  | ## 기존 pattern | |
| def check_conditions(guard_1, guard_2): | |
| if (guard_1): | |
| if (guard_2): | |
| print('guard_1 & 2 are all satisfied') | |
| return True | |
| else: | |
| print('guard_2 is not satisfied') | |
| return False | |
| else: | 
  
    
      This file contains hidden or 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
    
  
  
    
  | username = "username" | |
| pwd = "pwd" | |
| if (check_username(username)): #1 guard 1 | |
| if (check_pwd(username, pwd)): #2 guard 2 | |
| pass | |
| else: | |
| print("암호가 잘못되었습니다.") | |
| else: | |
| print("사용자명이 잘못되었습니다.") | 
  
    
      This file contains hidden or 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
    
  
  
    
  | # 2. Text box에 있는 데이터 불러오기 | |
| ## presentation.슬라이드.텍스트 포함 셰이프.TextFrame.TextRange.Text | |
| print('2. Text box에 있는 데이터 불러오기') | |
| print(presentation.Slides(2).Shapes('Title 1').TextFrame.TextRange.Text) | |
| print(presentation.Slides(2).Shapes('Rectangle 4').TextFrame.TextRange.Text) | |
| print(presentation.Slides(2).Shapes('TextBox 6').TextFrame.TextRange.Text) | |
| # 3. Table에 있는 데이터 불러오기 | |
| ## table shape에 접근해 행과 열 번호로 데이터에 접근할 수 있다. | |
| ## Table 각각의 cell을 하나의 shape로 생각하고 TextFrame부터 Text까지 접근하면 된다. | 
  
    
      This file contains hidden or 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 win32com.client | |
| # 1. ppt file 열기 | |
| ppt = win32com.client.Dispatch('PowerPoint.Application') | |
| ppt.Visible = True | |
| presentation = ppt.Presentations.Open('pptx directiory') | |
| # 2. ppt slide를 순회하며 shape에 접근 | |
| print('\nAs-is ---') | |
| for slide in presentation.Slides: # presentation.Slides는 presentation 내에 장표들 | 
  
    
      This file contains hidden or 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 xlwings as xw | |
| # 1. 엑셀 앱 실행 | |
| ## 엑셀 앱을 실행한 후 작업하고자 하는 workbook을 생성한다. | |
| ## 여러 개의 파일을 다룰 때 xw.APP()를 사용하면 여러 개의 파일을 효과적으로 다룰 수 있기 때문에 편리하다. | |
| ## visible 설정을 False로 하면 엑셀 화면을 띄우지 않고 작업을 할 수 있다. | |
| app = xw.App(visible = True) ## 엑셀 화면을 보지 않고 작업하길 원하면 visible = False로 지정하면 된다. | |
| wb = xw.Book() | |
| wb.sheets.add(after = wb.sheets[-1]) #맨 뒤에 하나의 시트를 추가한다. | 
  
    
      This file contains hidden or 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 xlwings as xw | |
| # 1. workbook 접근 | |
| ## 열고자하는 excel file의 경로를 입력한다. | |
| ## 빈칸으로 둘 경우 빈 excel file 하나를 생성한다. | |
| wb = xw.Book() | |
| # 2. workbook 내 sheet 접근 | |
| ## sheets['sheet 이름'] or sheets[순서]로 접근 | 
  
    
      This file contains hidden or 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 | |
| from collections import deque | |
| def solve(): | |
| def BFS(r, c): | |
| nonlocal table | |
| dr = [0,0,1,-1] | |
| dc = [1,-1,0,0] | |
| q = deque() | 
  
    
      This file contains hidden or 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 | |
| Dir = { #동 서 북 남 | |
| 1:(0,1), | |
| 2:(0,-1), | |
| 3:(-1,0), | |
| 4:(1,0) | |
| } | |
| class dice: | |
| def __init__(self,r, c): | 
  
    
      This file contains hidden or 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 | |
| def solve(R,C,L): | |
| global white, blue, TABLE | |
| def check(color): | |
| for r in range(L): | |
| for c in range(L): | |
| cur_r, cur_c = R+r, C+c | |
| if color != TABLE[cur_r][cur_c]: | 
  
    
      This file contains hidden or 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 = int(input()) | |
| DP = [0]*(x + 1) #DP 1은 0 | |
| for idx in range(2, x+1): | |
| if idx % 6 == 0: | |
| DP[idx] = min(DP[idx-1],DP[idx//3], DP[idx//2]) + 1 | |
| elif idx % 3 == 0: | |
| DP[idx] = min(DP[idx-1],DP[idx//3]) + 1 | |
| elif idx % 2 == 0: | |
| DP[idx] = min(DP[idx-1],DP[idx//2]) + 1 | 
NewerOlder