编写一个学生类,产生一堆学生对象 要求:有一个计数器(属性),统计总共实例了多少个对象

class Student():
count = 0
def init(self,name):
self.name = name
Student.count += 1
a = Student(‘A’)
b = Student(‘B’)
c = Student(‘C’)
e = Student(‘D’)
print (Student.count)

Python作业 11.16

相关文章:

  • 2021-07-24
  • 2022-01-07
  • 2021-07-12
  • 2021-08-08
  • 2021-05-15
猜你喜欢
  • 2021-12-09
  • 2021-08-25
  • 2021-06-10
  • 2021-08-25
  • 2021-11-23
  • 2021-06-27
相关资源
相似解决方案