minutes = 400 hours = 956 days = 76 weeks = 4 season = 3 year = 0 def comp_time(minutes, hours, days, weeks, season, year): #minutes add_hours = 0 left_minutes = 0 if minutes > 59: left_minutes = minutes % 60 minutes = minutes - left_minutes add_hours = minutes / 60 minutes = left_minutes if add_hours > 0: hours = hours + add_hours #hours add_days = 0 left_hours = 0 if hours > 23: left_hours = hours % 24 hours = hours - left_minutes add_days = hours / 24 hours = left_hours if add_days > 0: days = days + add_days #days add_weeks = 0 left_days = 0 if days > 7:#confused on whether this should be 6 or 7 left_days = days % 7 days = days - left_days add_weeks = days / 7 days = left_days if add_weeks > 0: weeks = weeks + add_weeks #weeks add_seasons = 0 left_weeks = 0 if weeks > 5:#confused on whether this should be 5 or 6 left_weeks = weeks % 6 weeks = weeks - left_weeks add_seasons = weeks / 6 weeks = left_weeks if add_seasons > 0 seasons = seasons + add_seasons #seasons add_years = 0 left_seasons = 0 if seasons > 8:#confused on whether this should be 7 or 8 left_seasons = seasons % 8 seasons = seasons - left_seasons add_years = seasons / 8 seasons = left_seasons if add_seasons > 0 year = year + add_years #years do not need compiling comp_time(minutes, hours, days, weeks, season, year)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question