def time(**tim):
c = 0
for i in tim:
if int(i) <= 24 and int(i) >=0:
c = int(i) *60
if int(tim[i]) < 60 and int(tim[i]) >=0:
c += int(tim[i])
return ("转换后的总分钟为%d"%c)
hour = input("请输入小时")
mins = input("请输入分钟")
dict1 = {hour:mins}
if __name__ == "__main__":
print(time(**dict1))
def data(times):
if times <= 1440 and times >=0:
hour = int(((int(times)/60))) #取小时
minx = int(((int(times)%60))) #取分钟
if minx == 0: #如果分钟是0
return ("标准时间是%d:00"%(hour))
if minx != 0:
return ("标准时间是%d:%d"%(hour,minx))
if __name__ == "__main__":
print(data(500))
转载于:https://www.cnblogs.com/classmethond/p/8492650.html