How Many Days to Go Viral?
Intermediate · Write the code · from Effects of Computing: Benefits, Harms and the Digital Divide
From the lesson: Effects of Computing: Benefits, Harms and the Digital Divide
People create computing innovations to do one job well, and those innovations then change how everyone works, plays and learns in ways their creators never fully planned. Think about how everyday tasks have changed. Homework goes through an online portal instead of a paper stack on the teacher's desk.
Read the lessonAn app starts with 1 user. Each day, every user brings shares_per_person new users. Write days_to_reach(goal, shares_per_person) that returns how many days it takes until there are at least goal users. If 1 user already meets the goal, return 0.
days_to_reach(100, 1) -> 7 (1, 2, 4, 8, 16, 32, 64, 128)What Check runs
Your code runs first, then each of these lines, and 2 more that stay hidden. The output must match exactly.
| Runs | Expected output |
|---|---|
| print(days_to_reach(100, 1)) | 7 |
| print(days_to_reach(1000000, 3)) | 10 |
More Effects of Computing exercises
- Find the Digital Divide GapBeginner
- Which Groups Are Below the Goal?Intermediate