Skip to content

Commit 3f91b77

Browse files
committed
FInalized
1 parent bbfabd6 commit 3f91b77

1 file changed

Lines changed: 10 additions & 20 deletions

File tree

recursion/outbreak.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,19 @@
33
@author Morgan Bergen
44
@date March 28 2022
55
@brief Exercise 2: Outbreak Returns
6-
76
Flu season is upon us and the number of people getting sick is growing.
8-
97
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)
17+
day n = ((n - 1) + (n - 2) + (n - 3)) people
2618
'''
27-
28-
2919

3020
def main():
3121
print("OUTBREAK!")

0 commit comments

Comments
 (0)