Write a function print_daily_totals(rainfalls) that prints the total rainfall for each day of rainfall values given. The parameter rainfalls is a list of rows, where each row is a list of rainfall values for a day, like the rainfalls list described earlier in this learning module except that rows may be of any length. Output should be formatted as in the table below. Note: This is intended as an exercise requiring the use of nested for loops, so you are not allowed to use the built-in sum function. For example: Test Result daily_rain = [ [0, 9, 3, 7], [11, 9, 0, 0], [0, 10, 12, 20], [0, 0, 0, 0], [1, 3, 4, 1], [2, 8, 10, 0], [0, 0, 0, 0] Day 0 total: 19 Day 1 total: 20 Day 2 total: 42 Day 3 total: 0 Day 4 total: 9 Day 5 total: 20 Day 6 total: 0 print_daily_totals(daily_rain) patchy_rain = [ [1, 7, 9], [), [9, 1, 2], [10, 5], [20] Day 0 total: 17 Day 1 total: 0 Day 2 total: 12 Day 3 total: 15 Day 4 total: 20 print_daily_totals(patchy_rain)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Write a function print_daily_totals(rainfalls) that prints the total rainfall for each day of rainfall values given. The
parameter rainfalls is a list of rows, where each row is a list of rainfall values for a day, like the rainfalls list described
earlier in this learning module except that rows may be of any length.
Output should be formatted as in the table below.
Note: This is intended as an exercise requiring the use of nested for loops, so you are not allowed to use the built-in
sum function.
For example:
Test
Result
daily_rain = [
[о, 9, 3, 71,
[11, 9, 0, 0],
[о, 10, 12, 201,
[0, 0, 0, 0],
[1, 3, 4, 1),
[2, 8, 10, 0],
[0, 0, 0, 0]
Day 0 total: 19
Day 1 total: 20
Day 2 total: 42
Day 3 total: 0
Day 4 total: 9
Day 5 total: 20
Day 6 total: 0
print_daily_totals(daily_rain)
patchy_rain = [
[1, 7, 9],
[],
[9, 1, 21,
[10, 5],
[20]
Day 0 total: 17
Day 1 total: 0
Day 2 total: 12
Day 3 total: 15
Day 4 total: 20
print_daily_totals(patchy_rain)
Transcribed Image Text:Write a function print_daily_totals(rainfalls) that prints the total rainfall for each day of rainfall values given. The parameter rainfalls is a list of rows, where each row is a list of rainfall values for a day, like the rainfalls list described earlier in this learning module except that rows may be of any length. Output should be formatted as in the table below. Note: This is intended as an exercise requiring the use of nested for loops, so you are not allowed to use the built-in sum function. For example: Test Result daily_rain = [ [о, 9, 3, 71, [11, 9, 0, 0], [о, 10, 12, 201, [0, 0, 0, 0], [1, 3, 4, 1), [2, 8, 10, 0], [0, 0, 0, 0] Day 0 total: 19 Day 1 total: 20 Day 2 total: 42 Day 3 total: 0 Day 4 total: 9 Day 5 total: 20 Day 6 total: 0 print_daily_totals(daily_rain) patchy_rain = [ [1, 7, 9], [], [9, 1, 21, [10, 5], [20] Day 0 total: 17 Day 1 total: 0 Day 2 total: 12 Day 3 total: 15 Day 4 total: 20 print_daily_totals(patchy_rain)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY