Python includes exercises 20
Title: a ball free fall from a height of 100 meters, after each landing anti jump back half its original height; down again, find it at the 10th floor, after a total of how many meters? 10th rebound tall?
Program Analysis: None
Source Code:
#!/usr/bin/python # -*- coding: UTF-8 -*- Sn = 100.0 Hn = Sn / 2 for n in range(2,11): Sn += 2 * Hn Hn /= 2 print 'Total of road is %f' % Sn print 'The tenth is %f meter' % Hn
The above example output is:
Total of road is 299.609375 The tenth is 0.097656 meter