전체 글 299

[Python] 클래스 : 상속(Inheritance)

상속(Inheritance) 객체 지향 프로그래밍(OOP)에서 상속(Inheritance)은 객체들 간의 관계를 구축하는 방법 일반적인 클래스 형태 다른 클래스에서 '상속받은' 클래스 형태 class BaseClassName: 기반 클래스의 변수, 함수(메서드) 등의 코드 … 기반 클래스의 변수, 함수(메서드) 등의 코드 class DerivedClassName(BaseClassName): 파생 클래스의 변수, 함수(메서드) 등의 코드 … 파생 클래스의 변수, 함수(메서드) 등의 코드 연습 1 부모 클래스 class Person: def __init__(self, name, age): self.name = name self.age = age def print_info(self): class_name = ..

Python 2022.08.29

[Python] 웹크롤링? 웹 스크래핑

웹크롤링? 웹 스크래핑! 📌 간단하게 웹에 알아보기 더보기 웹 (World Wide Web) 월드와이드웹(World Wide Web) 인터넷에 연결된 컴퓨터를 통해 사람들이 정보를 공유할 수 있는 전 세계적인 정보 공간 간단히 웹(Web)이라고 부르는 경우가 많다. 인터넷에서 HTTP 프로토콜, 하이퍼텍스트, HTML 형식 등을 사용하여 그림과 문자를 교환하는 전송방식을 말하기고 함. 웹 브라우저 HTML, CSS, JS로 이루어진 웹페이지를 사용자에게 보여주기 위한 프로그램 예 : 사파리, 파이어폭스, 크롬, 엣지, 오페라, 웨일 등 웹크롤러 crawl ; 기어가다, 서서히 가다 웹페이지에 연결되어 있는 모든 링크를 다 따라가서 리스트로 만든 후, 인덱싱을 한다. 이것을 데이터베이스에 저장한다. < 누..

Python 2022.08.28

[Python] 모듈(Module)

모듈(Module) Keyword 모듈의 정의 모듈 만들어서 사용하기 모듈 리네이밍(Re-naming) I. 모듈의 정의 함수나 변수, 클래스를 모아놓은 파일 보통 .py 파일 하나가 하나의 모듈 import datetime datetime II. 모듈 만들어서 사용하기 1. 모듈 만들기 jupyter에서 함수를 만들고, def calc_bmi(height, weight): height = height * 0.01 return weight / (height ** 2) File > Download as > Notbook.ipynb 로 저장한다. * 파일명은 이후에 불러올 모듈명.py로 변경하고 저장한다. (업로드 후에 변경도 가능하다) 작업하던 디렉토리에 만든 모듈 파일을 업로드한다. * 해당 모듈은 현재..

Python 2022.08.28

[Hacker Rank] Placement

📢 본 포스팅에 활용되는 기본 문제 및 자료 출처는 HackerRank 임을 밝힙니다. https://www.hackerrank.com ■ 문제 https://www.hackerrank.com/challenges/placements/problem Placements | HackerRank Write a query to output the names of those students whose best friends got offered a higher salary than them. www.hackerrank.com You are given three tables: Students, Friends and Packages. Students contains two columns: ID and Name. Fri..

[Hacker Rank] Top Competitors

📢 본 포스팅에 활용되는 기본 문제 및 자료 출처는 HackerRank 임을 밝힙니다. https://www.hackerrank.com ■ 문제 https://www.hackerrank.com/challenges/full-score/problem Top Competitors | HackerRank Query a list of top-scoring hackers. www.hackerrank.com The following tables contain contest data: Hackers: The hacker_id is the id of the hacker, and name is the name of the hacker. Difficulty: The difficult_level is the level of ..

[Hacker Rank] Ollivander's Inventory

📢 본 포스팅에 활용되는 기본 문제 및 자료 출처는 HackerRank 임을 밝힙니다. https://www.hackerrank.com ■ 문제 https://www.hackerrank.com/challenges/harry-potter-and-wands/problem Ollivander's Inventory | HackerRank Help pick out Ron's new wand. www.hackerrank.com ■ 풀이 문제 요구사항 Hermione decides the best way to choose is by determining the minimum number of gold galleons needed to buy each non-evil wand of high power and age. ..

[LeetCode] 176. Second Highest Salary

📢 본 포스팅에 활용되는 기본 문제 및 자료 출처는 리트코드 Problems, https://leetcode.com/problemset/all/임을 밝힙니다. ■ 문제 https://leetcode.com/problems/second-highest-salary/ Second Highest Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Table: Employee +-------------+------+ | Column Name | Type | +..

[LeetCode] 1179. Reformat Department Table

📢 본 포스팅에 활용되는 기본 문제 및 자료 출처는 리트코드 Problems, https://leetcode.com/problemset/all/ 임을 밝힙니다. ■ 문제 https://leetcode.com/problems/reformat-department-table/ Reformat Department Table - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Table: Department +-------------+---------+ | Column N..