Documentation can be found on : https://github.com/viktoriussuwandi/Time-Calculator
This is the result for the complete Time Calculator project. Instructions for building this project can be found at https://www.freecodecamp.org/learn/scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator
* Using tupple to pass variable between functions
* Using ternary operator to fix day and time calculation
* Using pytest to create online progress test
* self tester function to do pre test
-
Write a function named
add_time
that takes in two required parameters and one optional parameter:- a start time in the
12-hour clock
format (ending in AM or PM) - a
duration
time that indicates the number ofhours
andminutes
(optional) a starting day of the week, case insensitive
- a start time in the
-
The
function
should add theduration time
to thestart time
and returnthe result
. -
If
the result
will be thenext day
, it should show(next day)
afterthe time
. -
If
the result
will bemore
thanone day
later, it should show(n days later)
after the time, where "n" is thenumber
of days later. -
If
the function
is given the optionalstarting day
of the week parameter, then the output should displaythe day of the week
ofthe result
. -
The day of the week
in the output should appear afterthe time
and beforethe number of days later
. -
Below are some examples of different cases
the function
should handle. -
Pay close attention to the
spacing
andpunctuation
ofthe results
. -
Do not import any
Python libraries
. Assume thatthe start times
arevalid times
. -
The minutes
in the duration time will be a whole number less than 60, butthe hour
can be any whole number.
Write your code in time_calculator.py
. For development, you can use main.py to test your time_calculator()
function. Click the "run" button and main.py
will run.
The unit tests for this project are in test_module.py
. We imported the tests from test_module.py
to main.py for your convenience. The tests will run automatically whenever you hit the "run" button.