Created
          May 16, 2019 03:27 
        
      - 
      
 - 
        
Save MattHealy/08d22918ee430555c0a990c0c80797cb to your computer and use it in GitHub Desktop.  
    Convert minutes in to days, hours and minutes
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def convert(minutes): | |
| if isinstance(minutes, int): | |
| return str(minutes/24/60) + " day, " + \ | |
| str(minutes/60 % 24) + " hours, " + \ | |
| str(minutes % 60) + " minutes" | |
| else: | |
| return "0 days, 0 hours, 0 minutes" | |
| if __name__ == "__main__": | |
| values = [180, 181, 31, 1450, 1440, 1800, 1840, -100, None, 0] | |
| for val in values: | |
| print(str(val) + " minutes is " + convert(val)) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment