S
scottwd80
Here is the question that was asked and below that I'll paste the code I have so far. Any pointers would be great. Please keep in mind this is only my second week with python (or any programming for that matter) so I have no idea what I'm doing. How would you code this? Anyways, any help is GREATLY APPRECIATED!
I'd kind of like to figure it out with % rather than subtracting everythingalso, but doesn't really matter either way.
**If I leave my house at 6:52 am and run 1 mile at an easy pace (8:15 per mile), then 3 miles at tempo (7:12 per mile) and 1 mile at easy pace again, what time do I get home for breakfast?**
seconds = 1
hours = seconds / (60*60)
seconds = seconds - hours*60*60
minutes = seconds / 60
seconds = seconds - minutes *60
time_left_house = 6 * hours + 52 * minutes
miles_run_easy_pace = 2 * (8 * minutes + 15 * seconds)
miles_run_fast_pace = 3 * (7 * minutes + 12 * seconds)
total_time_run = miles_run_easy_pace + miles_run_fast_pace + time_left_house
print total_time_run, "Total time run: " , hours, 'Hours: ', minutes, 'Minutes: ', seconds, 'Seconds: '
FYI, i'm using python 2.7.6
I'd kind of like to figure it out with % rather than subtracting everythingalso, but doesn't really matter either way.
**If I leave my house at 6:52 am and run 1 mile at an easy pace (8:15 per mile), then 3 miles at tempo (7:12 per mile) and 1 mile at easy pace again, what time do I get home for breakfast?**
seconds = 1
hours = seconds / (60*60)
seconds = seconds - hours*60*60
minutes = seconds / 60
seconds = seconds - minutes *60
time_left_house = 6 * hours + 52 * minutes
miles_run_easy_pace = 2 * (8 * minutes + 15 * seconds)
miles_run_fast_pace = 3 * (7 * minutes + 12 * seconds)
total_time_run = miles_run_easy_pace + miles_run_fast_pace + time_left_house
print total_time_run, "Total time run: " , hours, 'Hours: ', minutes, 'Minutes: ', seconds, 'Seconds: '
FYI, i'm using python 2.7.6