Sep-01-2022, 08:02 PM
(This post was last modified: Sep-01-2022, 08:19 PM by rob101.
Edit Reason: to add code
)
(Sep-01-2022, 07:40 PM)Skaperen Wrote: how many weeks in a month?
I'd calculate that as 4.333 weeks in a month:~ 91 days = 3 month = 13 weeks.
4.333 * 3 is as close to 13 as makes no odds, but I've yet to work all of that in to my little script, so I'm unsure if it's going to work right now.
To add...
This is as far as I've got, as it's as far as I needed, for the time being:
hours = your_input day = 24 week = 7 days, hours = divmod(hours, day) weeks, days = divmod(days, week) if weeks: output = "Weeks: {}, Days: {}, Hours: {}".format(weeks, days, hours) elif days: output = "Days: {}, Hours: {}".format(days, hours) else: output = "Hours: {}".format(hours) print(output)
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein