class Ball:
def bounce(self):
if self.direction == "down":
self.direction = "up"
myBall = Ball()
myBall.direction = "down"
myBall.color = "small"
myBall.size = "small"
print "I just creatad a ball."
print "My ball is", myBall.size
print "My ball is",myBall.color
print "My ball's direction is",myBall.direction
print "now I'm going to bounce the ball"
print
myBall.bounce()
print "Now the ball's direction is", myBall.direction
myBall.direction
ball
最新推荐文章于 2018-05-10 21:00:40 发布