본문 바로가기

여러가지/Python

Day 16 - Object Oriented Programming(OOP)

● GIT URL : https://github.com/yooyijun15/Python/tree/main/Day16

 

Python/Day16 at main · yooyijun15/Python

Contribute to yooyijun15/Python development by creating an account on GitHub.

github.com

 

● 학습 내용

1) 객체 지향 프로그래밍 <=> 절차 프로그래밍

 

attributes : 객체 지향 프로그래밍의 변수

methods : 객체 지향 프로그래밍의 함수

 

클래스(Class, Blue Print)를 사용해서 객체(Object)를 생성한다.

※ 클래스는 단어의 첫글자 대문자로 쓴다.

ex) car = CarBlueprint()

car - 객체(Object)

CarBlueprint() - 클래스(Class)

 

ex) car.speed

car - 객체(Object)

speed - 변수(attributes)

 

ex) car.stop()

car - 객체(Object)

stop() - 함수(methods)

 

[참고] turtle 매뉴얼

URL :  https://docs.python.org/3/library/turtle.html

 

turtle — Turtle graphics

Source code: Lib/turtle.py Introduction: Turtle graphics is an implementation of the popular geometric drawing tools introduced in Logo, developed by Wally Feurzeig, Seymour Papert and Cynthia Solo...

docs.python.org

 

[참고] turtle 색상

URL : https://cs111.wellesley.edu/reference/colors

 

CS111 - Turtle Colors

 

cs111.wellesley.edu

 

2) 패키지 

[사이트] PyPI - 패키지 다운로드

URL : https://pypi.org/

 

PyPI · The Python Package Index

The Python Package Index (PyPI) is a repository of software for the Python programming language.

pypi.org

 

ex) 아래의 순서로 패키지에 접근한다.

https://pypi.org/search/?q=pretty+table

https://pypi.org/project/prettytable/

https://code.google.com/archive/p/prettytable/wikis/Tutorial.wik

 

PyCharm에서 패키지 다운로드 방법

 

정상적으로 패키지가 설치되면 아래와 같이 불러올 수 있다.

우클릭하여 아래의 경로로 들어가면 코드 확인할 수 있다.

 

'여러가지 > Python' 카테고리의 다른 글

Day 18 - Turtle, colorgram, tuples(터플), PyCharm  (0) 2024.04.27
Day 17 - Class(클래스)  (0) 2024.04.20
Day 15 - 프로젝트 Coffee Machine  (0) 2024.04.16
Day 14 - 프로젝트 Higher Lower  (0) 2024.04.16
Day 13 - Debug(디버그)  (0) 2024.04.11