Guest User

Untitled

a guest
Nov 14th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. def bouncingBall(h, bounce, window):
  2. BounceFactor = bounce
  3. BallDropHeight = h
  4. ViewerHeight = window
  5. BounceLeft = h
  6. BallSeenTimes = 1
  7. if bounce > 1 or bounce < 0 or window >= h or h ==0:
  8.  
  9. return -1
  10. else:
  11. while (BounceLeft > ViewerHeight):
  12. BounceLeft = BounceLeft * BounceFactor
  13. if (BounceLeft > ViewerHeight):
  14. BallSeenTimes = BallSeenTimes + 2
  15. else:
  16. break
  17. return BallSeenTimes
Add Comment
Please, Sign In to add comment