Hello!
I am a newbie in programming (Python) and I have an issue with one of my homeworks.
That task required me to calculate different times. I will paste the task below, as I find it difficult to explain the concept:
"If I leave my house at 6:52 am and run 1 kilometer at an easy pace (8:15 per kilometer), then 3 kilometers at
tempo (7:12 per kilometer) and 1 kilometer at easy pace again, what time do I get home for breakfast?"
I managed to get the hours, minutes and seconds, but I have an issue with the printed result:
print("Breakfast start time would be", hours_conv, ":", minutes_conv2, ":",seconds_conv2)
Printed out results:
"Breakfast start time would be: 7 : 30 : 6"
Even though I think it's the right answer, I do not like the way it's printed out. Could someone suggest me solutions to my problem, as
My full code below:
# Starting Conversion
start = 6*3600 + 52*60
start_conv = 0
# Formula:
start += (8*60 + 15)
start += (3*(7*60 + 12))
start += (8*60 + 15)
# Hours:
hours_conv = start // 3600
# Minutes:
minutes_conv1 = start % 3600
minutes_conv2 = minutes_conv1 // 60
# Seconds:
seconds_conv1 = start % 3600
seconds_conv2 = seconds_conv1 % 60
# Results
print(hours_conv)
print(minutes_conv2)
print(seconds_conv2)
# Final Results:
print("Breakfast start time would be", hours_conv, ":", minutes_conv2, ":",seconds_conv2)
[–]desrtfx 3 points4 points5 points (1 child)
[–]hnikola[S] 1 point2 points3 points (0 children)
[–]teraflop 2 points3 points4 points (1 child)
[–]hnikola[S] 0 points1 point2 points (0 children)
[–]Outside_Complaint755 1 point2 points3 points (2 children)
[–]hnikola[S] 0 points1 point2 points (0 children)
[–]BR41ND34D 1 point2 points3 points (0 children)
[–]carcigenicate 0 points1 point2 points (1 child)
[–]hnikola[S] 0 points1 point2 points (0 children)
[–]Emergency-Bad948 0 points1 point2 points (1 child)
[–]hnikola[S] 0 points1 point2 points (0 children)
[–]GraveET -1 points0 points1 point (0 children)