Hi. I have created a program which works correctly, and was just wondering if someone could help me in writing another program which works in the same way, but if the code is different. Below is what the program has to do:
This is the program I have created:
Can someone help me then? Many thanks.
If a human heartbeats on average once a second for 78 years, how many times does the heart beat in a lifetime? (use 365.25 days per year). Re-write your program to prompt the user to input an average rate and total number of years and output the resulting heart beats in a lifetime.
Code:
print "--------Welcome To The Heartbeat Program--------" averagerate = input ("\nPlease enter your average heart rate:") totalyears = input ("Please enter the total number of years:") heartrate = 60 * 60 * 24 * 365.25 result = averagerate * heartrate * totalyears print "\nThe total heartbeats is:", "%.7d" % (result) print "\n--------End Program--------"
Comment