Skip to content

Instantly share code, notes, and snippets.

@minorsecond
Created April 13, 2015 15:08
Show Gist options
  • Save minorsecond/e5d7312ecd5e6b445548 to your computer and use it in GitHub Desktop.
Save minorsecond/e5d7312ecd5e6b445548 to your computer and use it in GitHub Desktop.
def time_formatter():
"""
Takes user input as 00:00, splits those using : as seperator,
and prints the time formatted for timesheet in tenths of an
hour
"""
time_input = raw_input("\nTime Formatter\n" \
"Please enter hours and minutes worked today" \
"in 00:00 format: ")
if len(time_input.split(':')) == 2:
split_hours = time_input.split(':')[0]
split_minutes = time_input.split(':')[1]
round_minutes = round_to_nearest(int(split_minutes))
print "Your timesheet entry is {0}:{1}".format(split_hours, round_minutes)
main_menu()
else:
print "Please check input format and try again. (00:00)"
time_formatter()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment