**tvtime.py**: *10 points*

Real-World Motivation

One of the most common uses of technology today is for personal entertainment. Whether it’s to watch movies, TV, or listen to music, many people enjoy spending time interacting with streaming services. Some programmers are more productive writing code while listening to music, so they might have Pandora or Spotify open in a browser tab while programming. Others might enjoy unwinding after a long day by watching an episode or two (or four…) of a TV show. However, it’s very annoying entering a “show hole” — that time when you’ve finished watching one series and you aren’t sure which one to start next.

What isn’t immediately obvious when deciding which new TV series to start is knowing how long you’ll be able to enjoy the show. Will this only give me 6 hours of entertainment, or will I be watching for 100 hours?

In this part of the lab, we will be writing a program that calculates how many hours a TV series will take to watch and present that total time in an easy to understand format. In particular, we will first ask the user for three inputs:

- How long (in minutes) is each episode in this TV series?
- How many episodes are there in each season of the TV series?
- How many seasons are available to watch of the TV series?

Using these three pieces of information, we will then calculate the total number of hours that it will take to watch the entire TV series. Using that total, we will finally output to the user how many weeks, days, and hours are spanned by that total amount of time.

For example, if the user enters the following inputs:

```
How many minutes per episode? 30
How many episodes in each season? 26
How many seasons are there to watch? 15
```

then the total amount of time it will take to watch the show is:

$$ \frac{15 \times 26 \times 30}{60} = 195\space hrs $$

since there were 15 seasons `*`

26 episodes/season `*`

30 minutes/episode and there are 60 minutes/hour.

Because 195 hours is such a long time, we want to present that in an easier-to-understand format:

```
It will take 195 hours to watch this TV series, which is:
1 weeks, 1 days, and 3 hours
```

Notice that we’re ignoring grammatical issues such as “weeks” vs. “week” – please do not worry about being grammatically correct in your output.

The program has 4 main steps:

Get the three inputs from the user, and store them in variables named

`minutes`

,`episodes`

,`seasons`

To ask the user for a whole number, we want to use the following:

`minutes = int(input("How many minutes per episode? "))`

and similar for

`episodes`

and`seasons`

.Calculate the total number of hours spent watching using the three inputs, and store the result in a variable called

`hours`

.Calculate the number of weeks

`w`

, days`d`

, and leftover hours`h`

that are in`hours`

, where`d`

should be a number between 0 and 6 and`h`

should be a number between 0 and 23. The remainder operator (also called mod)`%`

and the integer division operator`//`

will be particularly useful here.Integer Division ( // ) and Remainder ( % )

Consider dividing fourteen by four, i.e. $14 \div 4$. We’d normally say $14 \div 4$ equals 3.5. But we could also think in terms of

**integer division**, where we’d say $14 \div 4$ equals 3 with a remainder of 2.In Python a single slash means float division, so

`14/4`

evaluates to`3.5`

. A double slash, however, gives the integer component of integer division, and thus`14//4`

evaluates to`3`

. The remainder operator (mod) gives whatever value is left over after the integer division. So`14%4`

yields`2`

.More generally,

`x//y`

evaluates to the number of times`y`

goes wholly into`x`

, and`x%y`

evaluates to what’s left over afterwards. These operations turn out to be surprisingly useful, as we’ll now see.Since this step of the algorithm is a bit more complex than the previous one, we’ll break it into three sub-steps, one for each variable that we’re calculating.

- Set
`h = hours % 24`

. To see why, note that`h`

should be the number of extra hours that aren’t used up by whole days. That is,`h`

should be whatever remains after we divide`hours`

by 24 to get days, which is exactly what`hours % 24`

means. - Set
`d = ???`

(This part is for you to figure out. Before you start programming.) - Set
`w = ???`

(This part is also for you to figure out. Likewise, before you start programming.)

*Note: You might find it more intuitive to calculate*`w`

before calculating`d`

.- Set
Print the total number of

`hours`

, as well as the equivalent number of weeks`w`

, days`d`

, and hours`h`

for the user.

Create a program called `tvtime.py`

that implements the design above. An outline of the program is provided in the assignment on replit.

Test your program by trying a variety of inputs. You can start with the examples below, but you should try others as well, especially numbers that you think could be troublesome.

```
Welcome to the TV Series Time Calculator!
This program will properly calculate the number of weeks, days, and leftover hours it will take to watch a given TV series.
How many minutes per episode? 30
How many episodes in each season? 26
How many seasons are there to watch? 15
It will take 195 hours to watch this TV series, which is:
1 weeks, 1 days, and 3 hours
```

```
Welcome to the TV Series Time Calculator!
This program will properly calculate the number of weeks, days, and leftover hours it will take to watch a given TV series.
How many minutes per episode? 60
How many episodes in each season? 13
How many seasons are there to watch? 5
It will take 65 hours to watch this TV series, which is:
0 weeks, 2 days, and 17 hours
```