Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
24 hrs to 12 hrs in phyton
Want to convert the given time in hours from 24 hrs to a time in hour for 12 hour clock
6 Respostas
+ 6
If greater than one, you use "pm".
+ 4
if you divide current time by 12 and the output is greater than 1, you have pm else am, then you only have to print the modulo of currTime % 12 and am/pm.
+ 1
You can't use return outside of a function. Also it's probably easier to just check if hour > 12 than if hour % 12 > 1
0
what if greater than 1
0
i want to return tge time but on 12 hour clock
https://code.sololearn.com/cgG9oOXRyw8Q/?ref=app
0
the code is wrong