File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # bounce.py
2- #
3- # Exercise 1.5
4- height = 100 # meters
5- bounces = 0 # number of bounces
1+ """
2+ bounce.py
3+ Exercise 1.5
4+ """
65
7- while bounces < 10 :
8- bounces = bounces + 1
9- height = height * (3 / 5 )
6+ HEIGHT = 100 # meters
7+ BOUNCES = 0 # number of bounces
8+
9+ while BOUNCES < 10 :
10+ BOUNCES = BOUNCES + 1
11+ HEIGHT = HEIGHT * (3 / 5 )
1012 # print(height)
11- print (round (height , 4 ))
13+ print (round (HEIGHT , 4 ))
Original file line number Diff line number Diff line change 1- # sears.py
1+ """ sears.py calculates the number of dollar bills needed to equal the height of the Sears Tower"""
22
3- bill_thickness = 0.11 * 0.001 # Meters (0.11 mm)
4- sears_height = 442 # Height (meters)
5- num_bills = 1
6- day = 1
3+ BILL_THICKNESS = 0.11 * 0.001 # Meters (0.11 mm)
4+ SEARS_HEIGHT = 442 # Height (meters)
5+ NUM_BILLS = 1
6+ DAY = 1
77
8- while num_bills * bill_thickness < sears_height :
9- print (day , num_bills , num_bills * bill_thickness )
10- day = day + 1
11- num_bills = num_bills * 2
8+ while NUM_BILLS * BILL_THICKNESS < SEARS_HEIGHT :
9+ print (DAY , NUM_BILLS , NUM_BILLS * BILL_THICKNESS )
10+ DAY = DAY + 1
11+ NUM_BILLS = NUM_BILLS * 2
1212
13- print ('Number of days' , day )
14- print ('Number of bills' , num_bills )
15- print ('Final height' , num_bills * bill_thickness )
13+ print ('Number of days' , DAY )
14+ print ('Number of bills' , NUM_BILLS )
15+ print ('Final height' , NUM_BILLS * BILL_THICKNESS )
You can’t perform that action at this time.
0 commit comments