[Tutor] how to write a function

Bartruff, Pamela J. Pamela.J.Bartruff at supervalu.com
Mon Mar 24 14:28:13 CET 2008

Def convert_time(time):
"""split hours from minutes"
Time = raw_input("enter a time, in military: ")
If hours > 12
 Hours = hours - 12
 Am_or_pm = "p.m."
Output_hours = hours
Output_minutes = minutes
Output_hours = ""
 Am_or_pm = "a.m."

-----Original Message-----
From: Kent Johnson [mailto:kent37 at tds.net] 
Sent: Monday, March 24, 2008 8:07 AM
To: Bartruff, Pamela J.
Cc: tutor at python.org
Subject: Re: [Tutor] how to write a function

Bartruff, Pamela J. wrote:
> Hello Python users,
> I am very new to Python, how do I program that converts 24 hour time
> 12 hour time?  The program should have three functions(input,
> and output function) 

This sounds like a homework assignment. We will help with homework but 
we won't do it for you.

Do you know how to write a function? What is the time format? Where does

the input come from? What have you tried so far?


More information about the Tutor mailing list