PLEASE CODE USING PYTHON3! (PLEASE ANSWER BEFORE WEDNESDAY): (**Jupyter Notebook
ID: 3919582 • Letter: P
Question
PLEASE CODE USING PYTHON3! (PLEASE ANSWER BEFORE WEDNESDAY):
(**Jupyter Notebook** Highly Recommended)
For this multiple part question, you need to edit a file. Be sure to write clear comments on parts you code/edit yourself. The image of the question is attached is also linked. I have linked the files you will need. This question was meant to be done in jupyter notebook (.ipynb), but I made (.py) if you don't use that. Make sure it isn't too advanced either. Make it as simple as possible basically. Just use your better judgment please and thank you!
LINK TO FILES: https://drive.google.com/drive/folders/1Hlx4CGJ9nS1JTTfFSQModgyUNUtLFZQ0?usp=sharing
QUESTION BELOWExplanation / Answer
# Python program to convert time
# from 24 hour to 12 hour format
# Function to convert the date format
def convert12(h, m, s):
str = “”
# Checking if last two elements of time
# is AM and first two elements are 12
if h <= 12:
str+=h + “:” + m + “:” + s + “AM”
else:
# subtract 12 from hours
str += (h - 12) + “:” + m + “:” + s + “PM”
return str
# Driver Code
print(convert12(20, 05, 45))
Since time2.py wasnt available so here is the working code that performs what is asked.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.