Question
17.1 PROJECT 1 : Time Conversion Calculator My code is not properly distributing the minutes when you run the code. If the input for minutes
17.1 PROJECT 1 : Time Conversion Calculator
My code is not properly distributing the minutes when you run the code. If the input for minutes is over 60, it won't rounded it back down either. I will upload the prompt and my code.
Please help me find the bug in my code.
print("Welcome to the Time Conversion Calculator!") hours = int(input("Enter a number of hours: ")) minutes = int(input("Enter a number of minutes: ")) seconds = int(input("Enter a number of seconds: "))
print('') day=hours//24 hour=hours%24 minute=(minutes+(seconds//60)) second=seconds%60 print("Your time conversion is:") if hours==0 and minutes==0 and seconds==0: print(' No time units to report.') else: if day>0: print(' {} day'.format(day)) if hours==1: print(' {} hour'.format(hour)) else: print(' {} hours'.format(hour)) if minutes==1: print(' {} minute'.format(minute)) else: print(' {} minutes'.format(minute)) if seconds==1: print(' {} second'.format(second)) else: print(' {} seconds'.format(second)) print('Goodbye!')
In this project you will demonstrate your knowledge of decision making blocks such as it statements Objectives 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 Description 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 O'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 Goodbye! 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. Goodbye! 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 GoodbyeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started