My code works for all sample input hours of the day in Jupyter notebook but I get error message in HackerRank:
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'(it doesn't tell me which line)
input : string of AM/PM format output: string of military time
def timeConversion(s):
if int(s[:2]) < 12 and s[8] == "P":
time = int(s[:2]) + 12
print(str(time) + s[2:8])
elif int(s[:2]) == 12 and s[8] == "A":
time2 = int(s[:2]) - 12
print(str(time2) + s[2:8])
else:
print(str(s[0:8]))