Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to Use the Code Editor Select the Run Code button to execute the program. Select the Calculate Grade button to generate a score based

How to Use the Code Editor
Select the "Run Code" button to execute the program.
Select the "Calculate Grade" button to generate a score based on the completed tasks.
Continue to modify, run, and calculate your code until you are happy with the grade.
Select the "Submit" button to turn in the assignment to your instructor.
Scenario
You are given the number of days that you have been driving, and you will write a Python script to work out the equivalent number of years and weeks.
Aim
Write a script that takes user input as days and converts the days into years, weeks, and days, and then prints them out. We can ignore leap years. The aim of this activity is to use different arithmetic operators to split days into years, weeks, and days.
Steps for Completion
Go to your main.py file.
On the first line, ask the user how many days they've been driving for and declare the user input. It's an integer, so cast the string.
Then calculate the number of years in that set of days.
Next, convert the remaining days that weren't converted to years into weeks.
Then, get any remaining days that weren't converted to weeks.
Print everything out.
Finally, run the script with the python3 main.py command.
The output should look like Figure 2.5 shown below:
PF1e_2-1B-figure-2.5.png
Figure 2.5
Task #01: Generate the correct number of years, weeks, and days from user input.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions