You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: recursion/outbreak.py
+10-20Lines changed: 10 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -3,29 +3,19 @@
3
3
@author Morgan Bergen
4
4
@date March 28 2022
5
5
@brief Exercise 2: Outbreak Returns
6
-
7
6
Flu season is upon us and the number of people getting sick is growing.
8
-
9
7
On day 1, there was only 6 people had the flu
10
-
On day 2, it jumped to 20.
11
-
On day 3, there were 75
12
-
13
-
Every day since, the number of people who have the flu is equal to the last 3 days combined
14
-
You will make a program that will ask the user for what day they want a count of people with the flu for. Then display the amount. You must use recursion to solve the calculation of infected for a given day. Assume the user will input a valid day.
15
-
16
-
d = days
17
-
day people
18
-
1 = 6
19
-
2 = 20
20
-
3 = 75
21
-
4 = 75 + 20 + 6
22
-
4 = (4 - 1) + (4 - 2) + (4 - 3)
23
-
d = (d - 1) + (d - 2) + (d - 3)
24
-
recursive case
25
-
8
+
On day 2, it jumped to 20.
9
+
On day 3, there were 75
10
+
Every day since, the number of people who have the flu is equal to the last 3 days combined
11
+
You will make a program that will ask the user for what day they want a count of people with the flu for. Then display the amount. You must use recursion to solve the calculation of infected for a given day. Assume the user will input a valid day.
12
+
13
+
day 1 = 6 people
14
+
day 2 = 20 people
15
+
day 3 = 75 people
16
+
day 4 = ((4 - 1) people + (4 - 2) people + (4 - 3) people)
0 commit comments