Building on everything you have learned so far in this class, the objectives of this project are to demonstrate understanding of the following:

computer science


17.1 PROJECT 1 : Time Conversion Calculator


In this project you will demonstrate your knowledge of decision making blocks such as if statements.


Building on everything you have learned so far in this class, the objectives of this project are to demonstrate understanding of the following:

  • Input/output
  • Variables
  • Arithmetic expressions
  • Division and modulo
  • If-else statements
  • Equality and relational operators
  • Nested if-else statements
  • Code blocks and indentation


Given the knowledge that there are 60 seconds in a minute, 60 minutes in an hour, and 24 hours in a day, you will prompt the user for the for the number of hours, minutes, and seconds as integer inputs, and your program will output the converted time so that the larger units are as large as possible. The possible output units are days, hours, minutes, and seconds.

Make a note of the following:

  • Use singular and plural value names as appropriate, like 1 minute vs. 2 minutes.
  • Do not output a unit if its value is zero. For example: 2 hours and 1 second, NOT 0 days, 2 hours, 0 minutes and 1 second.
  • Your program must start by printing the welcome message: Welcome to the Time Conversion Calculator!
  • Your program should obtain the three inputs from the user, with the following prompts, in this order:
    • Enter a number of hours:
    • Enter a number of minutes:
    • Enter a number of seconds:
  • You can assume that the user will never enter a negative number, but they can enter one or more 0's. In the unique case that the user enters 0 for all three inputs, you should output: No time units to report.

Refer to the sample runs below for how to format your output. Note that the time values are indented 4 spaces.

Examples of a sample run:

Welcome to the Time Conversion Calculator!
​Enter a number of hours: 1
​Enter a number of minutes: 2
​Enter a number of seconds: 3
Your time conversion is:
    1 hour
    2 minutes
    3 seconds
Welcome to the Time Conversion Calculator!
​Enter a number of hours: 0
​Enter a number of minutes: 0
​Enter a number of seconds: 0

​Your time conversion is:
    No time units to report.
Welcome to the Time Conversion Calculator!
​Enter a number of hours: 30
​Enter a number of minutes: 20
​Enter a number of seconds: 1000
Your time conversion is:
    1 day
    6 hours
    36 minutes
    40 seconds

This project has three hidden test cases, that will not give you any type of feedback. If you are not able to pass the hidden test cases, make sure that your program is set up to use any input. It is likely you are hard-coding some part of your program if you are not able to pass the hidden test cases. Do not get frustrated. Instead, be sure to ask questions in class, in the helproom, or using Piazza.


  • Start by figuring out, ON PAPER how you would solve this problem using your own brain. Step away from the keyboard until you have this worked out. If you don't understand how to solve it yourself, you have no hope in instructing a computer how to solve it.
  • Start with seconds and work your way up
  • Develop and test incrementally. That is, write a piece of the solution, test that to make sure it works, then add another piece, test it, add another, test it, and so on. Start with the easiest most general cases and make sure they work before moving on to the exceptions. You should be testing these incremental solutions in Spyder and making sure it matches your paper solution; not throwing it at the zyBooks autograder. You should not paste anything into zyBooks until you are confident your solution works for all cases in Spyder.


Each project for this class must be your own individual effort. While we encourage discussion and collaboration for readings, activities, and labs, you are not allowed to work as a team for this, or any, project. If you discuss the project with other students, make sure you are just discussing the projects in general, and NOT sharing code. Verbally discussing a project with other students is encouraged, but the discussion should not be turned into an implementation. It is considered academic dishonestly if you share a project solution with another student. Simply showing your solution to another student almost guarantees a zero score as past experience shows that a student who asks to “look at” your solution will copy parts of it or pass it along to someone else.

Getting a solution from the internet through sites such as Chegg, or using code that was posted on reddit, is a guaranteed way to be flagged for plagiarism. We use an algorithm similar to turnitin for writing which compares student coding solutions to detect plagiarism. Many beginning programmers imagine that there are only one or two ways to solve a programming problem, so they believe they won’t get caught if they use the same solution as someone else. This is the same as believing that plagiarizing a short story but changing the character’s names will not be detected. Do not take the risk.

The penalty for plagiarism on a project is a score of 0 on the project, a further 5% is deducted from your final grade, and an Academic Dishonesty Report will be filed. Repeat offenses will result in a 0 as your final grade in the class. Instead of searching for questionable help on the internet for your problems, we encourage you to post your questions to Piazza.

While you are able to develop your Python code in your zyBook, you will benefit from using Spyder, which is the IDE (Integrated Development Environment) that we will use in this class. Spyder has a great debugging tool and is available in all of the campus labs. You can install Spyder on your personal machines and we have provided instructions on how to do so in D2L. After you finish your development in Spyder, you will submit your project in your zyBook.

For help with your projects, you can attend the help rooms, go to office hours, post on Piazza, and ask questions during class.

As a reminder, there are only 4 projects, the projects make up 15% of your final grade, you are not allowed to collaborate on projects, you are not allowed to drop a project, and late work will not be accepted.

Related Questions in computer science category