From 4f3d94cd770b7f99edcc313dd5a0192b91fb5645 Mon Sep 17 00:00:00 2001 From: MLKODER <72186520+MLKODER@users.noreply.github.com> Date: Fri, 2 Oct 2020 14:52:53 +0530 Subject: [PATCH] Update 24-12format_BAT.py I just made the minor changes to make the output more informative and declared the "nh" as a global variable. I hope you will like the change !!! --- 24-12format_BAT.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/24-12format_BAT.py b/24-12format_BAT.py index 314df66..ad1681a 100644 --- a/24-12format_BAT.py +++ b/24-12format_BAT.py @@ -1,11 +1,15 @@ -h=int(input()) -m=int(input()) -s=int(input()) -z=input() -if z=='PM': - nh=12+1*h +h=int(input("Please enter Hours :")) +m=int(input("Please enter the Minutes: ")) +s=int(input("Please enter the Seconds: ")) +z=input("Please enter the time zone in AM or PM: ") +nh=0 #This will be our new hour, which will be zero by default + +if z=="AM": + if h==12: + nh=0 + else: + nh=h + print("The time is:", nh,':',m,':',s) else: - if z=='AM': - if h==12: - nh=00 -print(nh,':',m,':',s) + nh=h + print("The time is:", nh,':',m,':',s)