Problem!!! | SoloLearn: Learn to code for FREE!

+5

Problem!!!

x = input() if "AM" in x: x = x.replace("AM", "") if "2:" in x: x = x.replace("2:", "02:") if "3:" in x: x = x.replace("3:", "03:") if "4:" in x: x = x.replace("4:", "04:") if "5:" in x: x = x.replace("5:", "05:") if "6:" in x: x = x.replace("6:", "06:") if "7:" in x: x = x.replace("7:", "07:") if "8:" in x: x = x.replace("8:", "08:") if "9:" in x: x = x.replace("9:", "09:") if "10:" in x: x = x.replace("10:", "10:") elif "0:" in x: x = x.replace("0:", "00:") if "11:" in x: x = x.replace("11:", "11:") elif "1:" in x: x = x.replace("1:", "01:") if "PM" in x: x = x.replace("PM", "") if "02:" in x: x = x.replace("02:", "14:") elif "2:" in x: x = x.replace("2:", "14:") if "03:" in x: x = x.replace("03:", "15:") elif "3:" in x: x = x.replac https://www.sololearn.com/coach/70?ref=app 4th test are wrong

1/12/2021 11:05:13 AM

$♡f¡

11 Answers

New Answer

+15

u can make it short🤗 a=input() b=a.replace("AM","").replace ("PM","") ans="" if a[-2:]=="PM": if b[1]==":": ans=str(int(b[0])+12)+b[1:] elif b[0:2]== "12": ans="12"+b[2:] else: ans=str(int(b[0:2])+12)+b[2:] else: if b[1]==":": ans="0"+b[0:] elif b[0:2]=="12": ans="00"+b[2:] else: ans=b print(ans)

+4

$♡f¡ At your first condition (AM), I think there has to be >> if "12:" in x << because there is 12:00 AM So for example, 12:43 AM --> 00:43

+4

Ok tnx

+3

Can you say me what you do I don't understand Manash Saikia

+3

[Solved] $♡f¡ check out it Easiest way For more u have to check python lessons👍🏻 https://code.sololearn.com/cEG1HrG5Hm3H/?ref=app

+3

I done it but can you say what you do in code I don't understand😂 Mr. Rahul

+3

Ok wait i will provide u the main topic☺

+3

$♡f¡ See this & try to understand It might be easiest way To solve above https://code.sololearn.com/cZ5ykehvD8zz/?ref=app

+3

Mr. Rahul you might check your logic on Military Time [Solved] code. Type 12:00 PM. Interesting code otherwise. 😎👍

+3

Kode Krasher : ) You have played well with my code

+2

https://code.sololearn.com/cXo8lKDWSFyv/?ref=app Try like this