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 1
1
def main ():
2
2
in_time = input ('What time is it? ' ).strip ()
3
3
time = convert (in_time )
4
+ # print(f'{in_time} converts to {time:.2f}')
4
5
if 7 <= time and time <= 8 :
5
6
print ('breakfast time' )
6
7
elif 12 <= time and time <= 13 :
@@ -14,18 +15,18 @@ def convert(time):
14
15
if time .rfind ('a.m.' ) != - 1 :
15
16
time = time [:time .rfind ('a' )]
16
17
hours , minutes = time .split (':' )
17
- converted_time = float (hours )+ (float (minutes )/ 600 )
18
+ converted_time = float (hours )+ (float (minutes )/ 60 )
18
19
return converted_time
19
20
20
21
elif time .rfind ('p.m.' ) != - 1 :
21
22
time = time [:time .rfind ('p' )]
22
23
hours , minutes = time .split (':' )
23
- converted_time = 12 + float (hours )+ (float (minutes )/ 600 )
24
+ converted_time = 12 + float (hours )+ (float (minutes )/ 60 )
24
25
return converted_time
25
26
26
27
else :
27
28
hours , minutes = time .split (':' )
28
- converted_time = float (hours )+ (float (minutes )/ 600 )
29
+ converted_time = float (hours )+ (float (minutes )/ 60 )
29
30
return converted_time
30
31
31
32
You can’t perform that action at this time.
0 commit comments