Q:

Trying to display a variable as a time when printed

So i have a variable that needs to be displayed as a time of day, i.e 3:02, and then make calculations off of that variable, i.e add 7 to the first variable, wellington,and have it displayed as 3:09.
This is a simple question, and it doesn't need to go into the datetime
is there a way i can do it, without datetime?
def traintimes():
    crofton = wellington + 7
    ngaio = crofton + 2
    awarua = ngaio + 2
    simla = awarua + 2
    boxhill = simla + 1
    kandallah = boxhill + 2
    raroa = kandallah + 2
    johnsonville = raroa + 2
    print ("Wellington:",wellington,"Crofton Downs:",crofton,"Ngaio:",ngaio,"Awarua Street:",awarua,"Simla Crescent:",simla,"Box Hill:",boxhill,"Kandallah:",kandallah,"Raroa:",raroa,"Johnsonville:",johnsonville)
wellington = int("3:02")
traintimes ()
wellington = int("3:28")
traintimes()
wellington = int("3:40")
traintimes()

A:

You want to use the datetime module instead of working with ints. Use timedelta to make the calculations.
Example:
import datetime

current_time = datetime.datetime.now()

crofton = current_time + datetime.timedelta(minutes=7)

Working with time can be very difficult without the correct library, I suggest taking the time to read the datetime documentation.
Also, this article is pretty much required reading for all programers who work with time.

