Yes, it is possible to convert minutes to hours without using two times the variable. Here's one way to do it:
Let's say you have a variable minutes
that you want to convert to hours. Instead of using minutes/60
to get the number of hours, you can use (1.0/60)*minutes
.
For example:
minutes = 120
hours = (1.0/60)*minutes
print(hours) # Output: 2.0
This way, you only use the variable minutes
once to get the number of hours.
Asked: 2021-12-23 11:00:00 +0000
Seen: 11 times
Last updated: Feb 17 '22