Time

Represents the time of day. attributes: hour, minute, second

Methods

init

Initializes a time object. hour: int minute: int second: int or float

Parameters

namedescriptiondefault

self

hour

0

minute

0

second

0

str

Returns a string representation of the time.

Parameters

namedescriptiondefault

self

Prints a string representation of the time.

Parameters

namedescriptiondefault

self

time_to_int

Computes the number of seconds since midnight.

Parameters

namedescriptiondefault

self

is_after

Returns True if t1 is after t2; false otherwise.

Parameters

namedescriptiondefault

self

other

add

Adds two Time objects or a Time object and a number. other: Time object or number of seconds

Parameters

namedescriptiondefault

self

other

radd

Adds two Time objects or a Time object and a number.

Parameters

namedescriptiondefault

self

other

add_time

Adds two time objects.

Parameters

namedescriptiondefault

self

other

increment

Returns a new Time that is the sum of this time and seconds.

Parameters

namedescriptiondefault

self

seconds

is_valid

Checks whether a Time object satisfies the invariants.

Parameters

namedescriptiondefault

self

Last updated