python类和函数

#/usr/bin/python
#coding=utf-8
class Car():
    def __init__(self,name,year):
        self.name = name
        self.year = year
    def model(self):
        vv = f"my car is {self.name} and my car year is {self.year}"
        return vv.upper()

my_new_car = Car ('audi','2020')
print(my_new_car.model())
作者:tigergao
功不唐捐 玉汝于成
原文地址:https://www.cnblogs.com/tigergaonotes/p/14359104.html