Python编程:显示自己的的姓名和学号,并将学号各位数字相加求和,并显示.
2019-03-31
展开全部
class name(object):
def __init__(self,name,number):
self.name=name
self.number=number
def name_print(self):
print( self.name)
print(self.number)
def sum_number(self):
s=0
for i in self.numbet:
s=s+int(i)
print(s)
def __init__(self,name,number):
self.name=name
self.number=number
def name_print(self):
print( self.name)
print(self.number)
def sum_number(self):
s=0
for i in self.numbet:
s=s+int(i)
print(s)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询