class Cal( object ) :
def __init__ ( self , v1, v2) :
if isinstance ( v1, int ) :
self .v1 = v1
if isinstance ( v2, int ) :
self .v2 = v2
def add( self ) :
return self .v1 +self .v2
def subtract( self ) :
return self .v1 -self .v2
def setV1( self , v) :
if isinstance ( v, int ) :
self .v1 = v
def getV1( self ) :
return self .v1
c1 = Cal( 10 , 10 )
print ( c1.add ( ) )
print ( c1.subtract ( ) )
c1.setV1 ( 'one' )
c1.v1 = 'one'
c1.v2 = 30
print ( c1.add ( ) )
print ( c1.subtract ( ) )
Y2xhc3MgQ2FsKG9iamVjdCk6CiAgICBkZWYgX19pbml0X18oc2VsZiwgdjEsIHYyKToKICAgICAgICBpZiBpc2luc3RhbmNlKHYxLCBpbnQpOgogICAgICAgICAgICBzZWxmLnYxID0gdjEKICAgICAgICBpZiBpc2luc3RhbmNlKHYyLCBpbnQpOgogICAgICAgICAgICBzZWxmLnYyID0gdjIKICAgIGRlZiBhZGQoc2VsZik6CiAgICAgICAgcmV0dXJuIHNlbGYudjErc2VsZi52MgogICAgZGVmIHN1YnRyYWN0KHNlbGYpOgogICAgICAgIHJldHVybiBzZWxmLnYxLXNlbGYudjIKICAgIGRlZiBzZXRWMShzZWxmLCB2KToKICAgICAgICBpZiBpc2luc3RhbmNlKHYsIGludCk6CiAgICAgICAgICAgIHNlbGYudjEgPSB2CiAgICBkZWYgZ2V0VjEoc2VsZik6CiAgICAgICAgcmV0dXJuIHNlbGYudjEKYzEgPSBDYWwoMTAsMTApCnByaW50KGMxLmFkZCgpKQpwcmludChjMS5zdWJ0cmFjdCgpKQpjMS5zZXRWMSgnb25lJykKYzEudjEgPSAnb25lJwpjMS52MiA9IDMwCnByaW50KGMxLmFkZCgpKQpwcmludChjMS5zdWJ0cmFjdCgpKQ==