11 2022 档案
摘要:class Employee: employeeNO = 20;#本公司职员编号目前最大值 def __init__(self,name,grade): self.name = name#姓名 self.grade = grade#级别 Employee.employeeNO += 1 self.i
阅读全文
摘要:class dog(object): def speak(self): print("狗叫") class cat(object): def speak(self): print("猫叫") class Person(object): def speak(self): print("人说普通话")
阅读全文
摘要:class B(): def __init__(self,b,*args,**kwargs): self.b = b def show(self): print(self.b) class B1(B): def __init__(self,b,b1,*args,**kwargs): super(B1
阅读全文
摘要:class Sofa(): def __init__(self): self.__color = "yellow" print("in Sofa init") def sitting(self): print("can sitting!") class Bed(): def __init__(sel
阅读全文
摘要:class person: def __init__(self,name,id): self.name = name self.id = id def show(self): print("我的名字是:" + self.name +" "+ "学号:"+self.id) class Student(
阅读全文
摘要:class Vector: def __init__(self,x=0.0, y=0.0, z=0.0): self.x = x self.y = y self.z = z def __str__(self): return 'Vector({0},{1},{2})'.format(self.x,s
阅读全文
摘要:##1.1 def x(): for i in range(3): print("python") print(x()) 1.2 def x(name): for i in range(3): print(f"python {name}。") print(x("I LOVE")) 1.3 def a
阅读全文
摘要://创建字典 x = {"吕布":"灭爸","罗彬":"逆子"} print(type(x)) //字典应用 a = {"罗彬":{"语文":70,"数学":60,"英语":80},"富刚":{"语文":80,"数学":70,"英语":90}} print(a) print(a["罗彬"]["数学"
阅读全文