-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise1-2.py
More file actions
26 lines (24 loc) · 1000 Bytes
/
exercise1-2.py
File metadata and controls
26 lines (24 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def main() -> None:
print("How many seconds are there in 42 minutes 42 seconds?")
print("42 * 60 + 42")
print(f"{42 * 60 + 42} seconds")
print()
print(
"How many miles are there in 10 kilometers? Hint: there are 1.61 kilometers in a mile."
)
print("10 / 1.61")
print(f"{round(10 / 1.61, 2)} miles")
print()
print(
"If you run a 10 kilometer race in 42 minutes 42 seconds, what is your average pace (time per mile in minutes and seconds)? What is your average speed in miles per hour?"
)
print("(42 * 60 + 42) / (10 / 1.61) // 60 and (42 * 60 + 42) / (10 / 1.61) % 60")
print(
f"{int((42 * 60 + 42) / (10 / 1.61) // 60)} minutes and {int(round((42 * 60 + 42) / (10 / 1.61) % 60))} seconds per mile"
)
print()
print("(10 / 1.61) / ((42 * 60 + 42) / 3600)")
print(f"{round((10 / 1.61) / ((42 * 60 + 42) / 3600), 2)} miles per hour")
print()
if __name__ == "__main__":
main()