03. Resources/Python(33)
-
[Python/SQL] PyMySQL - 패키지 설치
앞선 포스팅들에서 다양한 SQL문법들을 알아봤다. 나는 솔직히 SQL 문법을 mysql에 직접 접근해서 쓸 일이 거의 없다. 대부분의 기능 개발을 파이썬(python)으로 하기 때문이다! 그러면 파이썬에서 DB에 접근하려면 어떻게 해야하는가? 나는 database 관리는 mysql을 이용해서 하고있기 때문에, python과 mysql을 연결해주는 패키지를 쓰면 된다. 그 패키지 이름은 PyMySQL 이다. 설치는 간단하게 아래 커맨드를 이용하면 된다. pip install PyMySQL 해당 환경에서 위의 패키지를 설치한 다음부터는 파이썬 스크립트에서 import pymysql 로 해당 패키지를 사용할 수 있다.
2021.08.21 -
[Python 문제풀이] 19일차 (끝)
Day 19 Q25. Minesweeper In the popular Minesweeper game you have a board with some mines and those cells that don't contain a mine have a number in it that indicates the total number of mines in the neighboring cells. Starting off with some arrangement of mines we want to create a Minesweeper game setup. 제출 코드 import numpy as np def minesweeper(matrix): import numpy as np def minesweeper(mat..
2020.07.27 -
[Python 문제풀이] 18일차
Day_18 Intro Q24. Mindsweeper In the popular Minesweeper game you have a board with some mines and those cells that don't contain a mine have a number in it that indicates the total number of mines in the neighboring cells. Starting off with some arrangement of mines we want to create a Minesweeper game setup. 알고리즘 고민, 및 러프한 코드 작성 중! 작성 흐름 # Test case import numpy as np matrix = [[True, Fals..
2020.07.26 -
[Python 문제풀이] 17일차
Day_17 Intro Q23. Box Blur Last night you partied a little too hard. Now there's a black and white photo of you that's about to go viral! You can't let this ruin your reputation, so you want to apply the box blur algorithm to the photo to hide its content. The pixels in the input image are represented as integers. The algorithm distorts the input image in the following way: Every pix..
2020.07.25 -
[Python 문제풀이] 16일차
Day_16 Intro Q22. avoidObstacles You are given an array of integers representing coordinates of obstacles situated on a straight line. Assume that you are jumping from the point with coordinate 0 to the right. You are allowed only to make jumps of the same length represented by some integer. Find the minimal length of the jump enough to avoid all the obstacles. 제출 코드 def avoidObstacles(inputArra..
2020.07.24 -
[Python 문제풀이] 15일차
Day_15 Intro Q22. avoidObstacles You are given an array of integers representing coordinates of obstacles situated on a straight line. Assume that you are jumping from the point with coordinate 0 to the right. You are allowed only to make jumps of the same length represented by some integer. Find the minimal length of the jump enough to avoid all the obstacles. 제출 코드 from math import gcd def sol..
2020.07.23