File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11def main ():
22 in_time = input ('What time is it? ' ).strip ()
33 time = convert (in_time )
4+ # print(f'{in_time} converts to {time:.2f}')
45 if 7 <= time and time <= 8 :
56 print ('breakfast time' )
67 elif 12 <= time and time <= 13 :
@@ -14,18 +15,18 @@ def convert(time):
1415 if time .rfind ('a.m.' ) != - 1 :
1516 time = time [:time .rfind ('a' )]
1617 hours , minutes = time .split (':' )
17- converted_time = float (hours )+ (float (minutes )/ 600 )
18+ converted_time = float (hours )+ (float (minutes )/ 60 )
1819 return converted_time
1920
2021 elif time .rfind ('p.m.' ) != - 1 :
2122 time = time [:time .rfind ('p' )]
2223 hours , minutes = time .split (':' )
23- converted_time = 12 + float (hours )+ (float (minutes )/ 600 )
24+ converted_time = 12 + float (hours )+ (float (minutes )/ 60 )
2425 return converted_time
2526
2627 else :
2728 hours , minutes = time .split (':' )
28- converted_time = float (hours )+ (float (minutes )/ 600 )
29+ converted_time = float (hours )+ (float (minutes )/ 60 )
2930 return converted_time
3031
3132
You can’t perform that action at this time.
0 commit comments