补充程序
class Person:def __init__(self):
self.__weight=56
def getweight(self):
( ) #返回属性“weight”的值
def setweight(self,v):
( ) #设置属性“weight”的值为v的值
x=Person()
v=int(input())
x.setweight(v)
print(x.getweight())
自己不会做?class Person:
def __init__(self):
self.__weight=56
def getweight(self):
return self.__weight
def setweight(self,v):
self.__weight=v
x=Person()
v=int(input())
x.setweight(v)
print(x.getweight())
页:
[1]