5. Conversion Language: Python 3 G Autocomplete Ready O 1 > #Assume there are 30 days in each month -.. The program takes number of days as input, and converts it into years, months, weeks and days. Assume that each month is 30 days long for the calculations. 4 5 # Enter your code here 7 vif _name_ == " _main__": Function Description You have to create the following functions: main() 1. get yr mth wk day takes one argument: total days, converts it in the number of years, months, weeks and days, and prints the output as specified in the output sample. If the number of years is 1, make sure it prints "year" and not "years", and same applies for months, weeks and days as well. 2. main program should input a number from the user (days), and check if the number is a positive integer or not. If not, it should print a message stating: "Input can be a positive integer only. Try Again!" and continue until the correct input is received. Once the input received is correct, make sure the error checking for 0 or negative numbers is taken care of according to the output samples. If all is fine, then it should call the get yr_mth wk_day function to print the division of days as per the requirement. Constraints • days >0 > Input Format For Custom Testing v Sample Case 0 Sample Input For Custom Testing 415 Sample Output There are: 1 year, 1 month, 2 weeks and 6 days in 415 total days. Explanation Divides the total days in years, months, weeks and days and prints the output Test Custom Run Code

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Python3 code required!

5. Conversion
Language: Python 3
C Autocomplete Ready O
1 > #Assume there are 30 days in each month...
The program takes number of days as input, and converts it into years, months, weeks and days. Assume
that each month is 30 days long for the calculations.
4
# Enter your code here
6
7 vif -name.
main__":
Function Description
You have to create the following functions:
==
8
main()
1. get yr_mth_wk_day takes one argument: total_days, converts it in the number of years, months, weeks and
days, and prints the output as specified in the output sample. If the number of years is 1, make sure it
prints "year" and not "years", and same applies for months, weeks and days as well.
2. main program should input a number from the user (days), and check if the number is a positive integer or not.
If not, it should print a message stating: "Input can be a positive integer only. Try Again!" and continue until
the correct input is received. Once the input received is correct, make sure the error checking for 0 or negative
numbers is taken care of according to the output samples. If all is fine, then it should call
the get yr_mth_wk_day function to print the division of days as per the requirement.
Constraints
• days > 0
> Input Format For Custom Testing
v Sample Case 0
Sample Input For Custom Testing
415
Sample Output
There are: 1 year, 1 month, 2 weeks and 6 days in 415 total days.
Explanation
Divides the total days in years, months, weeks and days and prints the output
Test
Custom
Run Code
Results
Input
::::
Transcribed Image Text:5. Conversion Language: Python 3 C Autocomplete Ready O 1 > #Assume there are 30 days in each month... The program takes number of days as input, and converts it into years, months, weeks and days. Assume that each month is 30 days long for the calculations. 4 # Enter your code here 6 7 vif -name. main__": Function Description You have to create the following functions: == 8 main() 1. get yr_mth_wk_day takes one argument: total_days, converts it in the number of years, months, weeks and days, and prints the output as specified in the output sample. If the number of years is 1, make sure it prints "year" and not "years", and same applies for months, weeks and days as well. 2. main program should input a number from the user (days), and check if the number is a positive integer or not. If not, it should print a message stating: "Input can be a positive integer only. Try Again!" and continue until the correct input is received. Once the input received is correct, make sure the error checking for 0 or negative numbers is taken care of according to the output samples. If all is fine, then it should call the get yr_mth_wk_day function to print the division of days as per the requirement. Constraints • days > 0 > Input Format For Custom Testing v Sample Case 0 Sample Input For Custom Testing 415 Sample Output There are: 1 year, 1 month, 2 weeks and 6 days in 415 total days. Explanation Divides the total days in years, months, weeks and days and prints the output Test Custom Run Code Results Input ::::
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education