id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

rmueller@lasacs.com > macro
prev  |  next  |  chance

Whereas a microwave accepts a max of 4 digits for the cook time, the new macrowave accepts up to 6 digits. If the time entered is 1 or 2 digits, the time is interpreted as seconds. If the time entered is 3 or 4 digits, it is interpreted as MM:ss (i.e. minutes and seconds). Finally if the time entered is 5 or 6 digits, it is interpreted as HH:MM:ss (i.e. hours, minutes, and seconds). The time entered is guaranteed to be between 1 and 999999. It is valid to enter values of 60 or more for each MM and ss. Return a string of the format "HH:MM:ss" representing the cook time. The MM or ss should returned should be less than 60 (i.e. they behave just like the MM:ss on a digital clock). For HH, MM, and ss values that are less than 10 return the value with a leading 0. Return the string "invalid" if the entered cook time represents 100 hours or more.


macro(60) → '00:01:00'
macro(99) → '00:01:39'
macro(100) → '00:01:00'

...Save, Compile, Run (ctrl-enter)

def macro(inTime):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 250

Copyright Nick Parlante 2017 - privacy