# #公有 私有
# class PersonInfo(object):
# __weight=55#私有属性
# def __info(self):#私有方法
# print('体重为:{}'.format(self.__weight))
# def get__weight(self):
# print('体重为:{}'.format(self.__weight))
# self.__info()
# p=PersonInfo()
# p1=PersonInfo()
# p.get__weight()
# class Person(object):
# def __init__(self,name,age):
# print('hello,world')
# self.name=name
# self.age=age
# def show(self):
# print(self.name,self.age)
#
# p1=Person('张三',18)
# p2=Person('李四',19)
# p1.show()
# p2.show()
#汽车租凭
# class car_rent(object):
#
# def __init__(self,car_types,cost):
# self.car_types = car_types
# self.cost = cost
#
# def price(self,day):
# self.day=day
# print('类型为{},单价为{}'.format(self.car_types,self.cost))
# print('价格为{}'.format(self.cost*day))
#
# def __del__(self):
# print('{}被销毁'.format(self.cost))
#
# car1=car_rent('1',100)
# car1.price(30)
# del car1
#
# class Yuan(object):
# def MianJi(self,r):
# print('圆面积为:',r*r*3.1415926)
# def ZhouChang(self,r):
# print('圆周长为:',2*r*3.1415926)
#
# class Shan(object):
# def MianJi(self,h,a):
# print('三角形面积为:',(h*a)/2)
# def ZhouChang(self,a,b,c):
# print('三角形周长为:',a+b+c)
#
# class JuXing(object):
# def MianJi(self,a,b):
# print('矩形面积为:',a*b)
# def ZhouChang(self,a,b):
# print('矩形周长为:',2*a+2*b)
#
# p1=Shan()
# p1.MianJi(3,4)
# p1.ZhouChang(3,4,5)
# class stu(object):
# def f(self,name,id,g):
# self.name=name
# self.id=id
# self.g=g
# print(name,id,g)
# def __del__(self):
# print('{},{},{}被销毁'.format(self.name,self.id,self.g))
#
#
# p1=stu()
# p1.f('11','34','435')
汽车租聘,圆,三角形,矩形的类
于 2023-11-09 11:33:20 首次发布