Created
          June 2, 2016 13:36 
        
      - 
      
 - 
        
Save tanayag/6ed6425ea0eebdeccf22182e4110901f to your computer and use it in GitHub Desktop.  
    AM/PM to Military Time Converter
  
        
  
    
      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
    
  
  
    
  | time = raw_input('Enter Time(hh:mm:ssAM/PM): ') | |
| AP = time[8] | |
| if AP == 'A' and time[0:2] == '12': | |
| ms = time.strip('AM') | |
| p = '00' | |
| print p + ms[2:] | |
| elif AP == 'A': | |
| print time.strip('AM') | |
| elif AP == 'P' and time[0:2] == '12': | |
| print time.strip('PM') | |
| elif AP == 'P' and time[0:2] != '12': | |
| mt = time.strip('PM') | |
| x = mt[0:2] | |
| x = int(x) | |
| y = x + 12 | |
| y = str(y) | |
| z = mt[2:] | |
| mt = y + z | |
| print mt | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment