Project 3: Time Functions

Due Date

See the calendar for due date.

Objectives:

Description

For this project, you get to calculate the number of days since the Epoch. Additionally, you get to calculate the number of days between two times provided by the user.

The time module provides a method (a special type of function) to get the number of seconds since the Epoch. For UNIX machines (including Mac machines), the Epoch is January 1, 1970. You can convert between seconds and days by dividing by the number of seconds in a minute (60), then dividing by the number of minutes in an hour (60), then divide by the number of hours in a day (24):

seconds / 60 / 60 / 24

Requirements

Write a Python 3 script that has a function for each of the following tasks:

  1. The main body of the script that calls the other functions
  2. Welcomes the user
  3. Calculates the number of days since the Epoch and returns that value
  4. Prompts the user for the start time (in seconds) and returns that value
  5. Prompts the user for the end time (in seconds) and returns that value
  6. Calculates the number of days between two dates in seconds (that are passed as parameters) and returns that value
This means that your script should have at least 6 functions and therefore should have "def" at least 6 times.
Name the main function of your script, main(). Have it call the other functions and display both the number of days since the Epoch and the number of days between the two times provided by the user. Round all displayed numbers to 1 decimal place (but don't round intermediate calculations).

Include comments at the top of the file with a description of the script, your name and the date. Additionally, include a descriptive comment before each function and each major section of your code. Describe in English (not code) what the function or section does. Be sure to include any assumptions. Write the comments for another software developer to read, meaning one that already knows Python.

Examples

Note, user input is in bold face blue and underlined text is required for test cases.
Welcome to My Time Functions Script!

There have been 19409.9 days since the Epoch

Please enter a start time in seconds: 123456789
You entered 123456789
Please enter an end time in seconds: 987654321
You entered 987654321
There have been 10002.3 days between the start time (123456789.0) and the end time (987654321.0)
Note: The number of days since the Epoch keeps changing. Write your script so that the correct number always displayed.

Welcome to My Time Functions Script!

There have been 19409.9 days since the Epoch

Please enter a start time in seconds: 23456789
You entered 23456789
Please enter an end time in seconds: 123456789
You entered 123456789
There have been 1157.4 days between the start time (23456789.0) and the end time (123456789.0)
Welcome to My Time Functions Script!

There have been 19409.9 days since the Epoch

Please enter a start time in seconds: 0
You entered 0
Please enter an end time in seconds: 1632270774
You entered 1632270774
There have been 18892.0 days between the start time (0.0) and the end time (1632270774.0)

Rubric:

Points       Item
----------   --------------------------------------------------------------
_____ / 10   Comments before each function and major section of code (written for another software developer; not too many comments and not too few)
_____ / 40   6+ functions (including main())
_____ / 20   Correct output
_____ /  2   Completed rubric (estimates for each line including hours spent)

_____ / 72   Total


_____  Approximate number of hours spent

I, (REPLACE WITH YOUR FULL NAME), affirm that the code that I submitted is my own work and that I did not receive help that was not authorized by the instructor.

Submission

Submit your project3.py and your rubric-project3.txt to the appropriate Assignment tab/folder in CougarVIEW.

Notes

  1. Before writing any code, write the major steps as comments. Then, iteratively go through and implement each step. For example, start with welcoming the user. Verify that it works. Then, work on the next step.
  2. To get the numbers to match exactly, only round the values when they are displayed (and don't store the rounded value).

Optional

The following are optional tasks that will not negatively affect your grade so long as implementing them does not disrupt the grading procedure of the requirements above:
  1. Install Pylint and have it analyze the style of your Python code.