Day 16 learn objectives:

<aside> 📌 OOP:物件導向程式設計(今日是基礎版1)

</aside>

1. Why do we need OOP and how does it work?

<aside> ✅ Object Oriented Programming (OOP)

过程式编程 - 维基百科,自由的百科全书

2. How to use OOP:Classes and Objects

老師的例子:

<aside> ✅ Waiter(真實的物件):

[Python物件導向]淺談Python類別(Class)

「物件導向」介紹

3. Constructing Objects and Accessing their Attributes and Methods

<aside> ✅ class Car

turtle - Turtle graphics - Python 3.10.2 documentation

Turtle Colors

練習:

#Option 1:
import turtle
tinny = turtle.Turtle()

#Option 2:
from turtle import Turtle, Screen
tinny = Turtle()
tinny.shape("turtle")
tinny.color("red","green")

#docs.python.org/3/library/turtle.html
myScreen = Screen()
print(myScreen.candlelight)
myScreen.exitonclick()

4. How to Add Python Packages and use Pypi

<aside> 💡 Packages(套件)為1個以上modules(模組)組成

</aside>

PyPI · The Python Package Index