Python program for updating the time by one second

625
Python program for updating the time by one second
h=int(input("Enter Hours: "))
m=int(input("Enter Minutes: "))
s=int(input("Enter Second: "))
if((h<0)or(m<0)or(s<0)): # hour or minute or seconds can not be -ve number 
 print("invalid data \n");
elif((h>12)or(m>59)or(s>59)): # the extreme boundary condition 
 print("\n invalid time entry \n");
else:
 s += 1    # increase the seconds by one 
if(s>59):
 s=0;      # after increment when s becomes more than 59 minute changes by 1 
 m += 1
if(m>59):
 m=0
 h += 1
if(h>12):
 h=1;
 print("Time updated by one second is \n",h, m, s);

    Output 1:
            Enter Hours: 12
            Enter Minutes: 59
            Enter Second: 59
            Time updated by one second is 
             1 0 0
    Output 2:
            Enter Hours: -2
            Enter Minutes: 4
            Enter Second: 8
            invalid data
    Output 3:
            Enter Hours: 2
            Enter Minutes: 59
            Enter Second: 65
            invalid time entry 

इन्हें भी देखें।

Python Programs के लिये यहाँ click करें।

 

Python program for updating the time by one second program for updating the time by one second in python write a program for update the time write a program for updating the time by one second write a program for updating the time by one second in python program for updating the time by one second updating time program updating time program in python time program time program in python