伙计们可以为这个问题编写Python代码。 [英] Guys could u write the Python code for this problem.

查看:64
本文介绍了伙计们可以为这个问题编写Python代码。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出带有后缀的12小时格式的时间,AM / PM,将其转换为24小时格式。 12小时格式为小时:分钟:秒后跟AM或PM,小时范围为0到12,小时范围为0到59,第二个范围为0到59. 24小时格式为小时:分钟和秒,小时范围从0到23,分钟范围从0到59,秒范围从0到59.所有三个组成部分:小时,分钟和秒以两位数格式表示



注意。午夜12点钟时间是12点钟格式的12:00:00 AM,24点钟格式是00:00:00。中午12点是12:00小时12小时格式,12小时格式是12:00:00



例如输入为07: 05:45 PM然后输出是19:05:45如果输入是07:05:45 AM那么输出是07:05:45



< b>输入格式:

时间为12小时格式,带后缀,AM或PM



输出格式:

打印时间为24小时格式



边界条件

0<小时,分钟和秒钟< 60

Meridian应该是AM或PM



我尝试过:



我很困惑这个问题,所以我无法弄清楚任何解决方案。请帮帮我

解决方案

很好的声明,现在你刚开始工作了。

我们不做你的HomeWork。 />
HomeWork不会在乞求其他人做你的工作时测试你的技能,它将帮助你的老师检查你对你所学课程的理解以及你应用它们时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

所以,开始工作吧。如果您遇到特定问题,请展示您的代码并解释这个问题,我们可能会提供帮助。


参见 Python教程& mdash; Python 3.3.6文档 [ ^ ]

Given a time in the 12 hour format with the suffix, either AM/PM, convert that into a 24 hour format. 12 hour format is hours:minutes:seconds followed by AM or PM, where the hours range is from 0 to 12, minutes range is from 0 to 59, second range is from 0 to 59. 24 hours format is hours:minutes and seconds, where hours range is from 0 to 23, minutes range is from 0 to 59, seconds range is from 0 to 59. All the three components: hours, minutes and seconds are represented in the two digit format

NOTE. Midnight is 12'o clock is 12:00:00 AM in the 12 hour format and it is 00:00:00 in 24 hour format. 12 noon is 12:00:00 PM in the 12 hour format and it is 12:00:00 in the 24 hour format

for example if input is 07:05:45 PM then the output is 19:05:45 and if the input is 07:05:45 AM then the output is 07:05:45

input format:
Time in 12 hour format with suffix, either AM or PM

Output format:
Print time in 24 hour format

Boundary Condition
0< hour, minute and seconds < 60
Meridian Should be either "AM" or "PM"

What I have tried:

well i am very much confused with the problem so i was not able to figure out any solution. Please help me out

解决方案

Nice statement, now you just have yo start to work.
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.


See The Python Tutorial &mdash; Python 3.3.6 documentation[^].


这篇关于伙计们可以为这个问题编写Python代码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆