识别 Python 中的面向对象程序
您正在审查公司里的代码,想找出面向对象编程的示例,并发现了以下代码片段。基于目前为止您所学的内容,以下哪些 Python 程序可被视为面向对象?
Program A:
def buy_car(make, model, price):
print("You've bought a ", make, model, "for $", price, "!")
Program B:
class Car():
def __init__(self, make, model):
self.make = make
self.model = model
本练习是课程的一部分
