Suppose a regional council wants to see the effect of reducing the chorophyll, nitrogen, and phosphorus values in a lake by a certain percentage each year. For example, Lake Whangape could do with a clean up: Define a function print_variables_over_time(c_0, tr_0, tp_0, percent_reduction, final_year) that accepts current levels for CHLA, TN, and TP and prints out a table showing a forecast of these values over time, provided all are reduced by the given percentage each year. Parameter summary • c_0, tr_0, and tp_e are initial CHLA, TN, and TP values respectively (i.e. at year 0). • percent_reduction is the percentage reduction in all three values, per year, and will be given as a value between 0 and 100. • final_year = number of the last year to print, e.g. 4 means print years 0, 1, 2, 3, 4. You can assume final_year is at least 1. Notes: . Use 'Year CHLA TN TP* for the header row. • The year should be printed with width 3 (ie, :3d will be helpful) • CHLA, TN, and TP should be printed with width 10 and 2 decimal places. (Hint: :10.2f will help.) • You must use a while loop for this - it will help with the next question! • You cannot use any for loops or list comprehensions. For example: Test print variables_over_time (128, 2048, 256, 12.5, 5) print variables_over_time (128, 1024, 256, 6.25, 10) Result Year 1 2 3 4 5 Year 0 1 2 3 4 5 6 7 8 9 10 TN CHLA 128.00 2048.00 112.00 1792.00 98.00 1568.00 85.75 1372.00 75.01 1200.50 65.65 1050.44 CHLA TN 128.00 1024.00 120.00 960.00 112.50 900.00 105.47 843.75 96.88 791.02 TP 256.00 92.70 741.58 86.90 695.23 224.00 196.00 171.50 TP 256.00 240.00 225.00 210.94 197.75 185.39 173.81 81.47 651.78 162.94 76.38 611.04 152.76 71.61 572.85 143.21 67.13 537.05 134.26 150.06 131.30

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Suppose a regional council wants to see the effect of reducing the chorophyll, nitrogen, and phosphorus values in a lake by a certain percentage each year.
For example, Lake Whangape could do with a clean up:
Define a function print_variables_over_time(c_a, tn_0, tp_0, percent_reduction, final year) that accepts current levels for CHLA, TN, and TP and prints out a table showing a forecast of these values over time, provided all are
reduced by the given percentage each year.
Parameter summary
• c_0, tr_e, and tp_e are initial CHLA, TN, and TP values respectively (i.e. at year 0).
• percent_reduction is the percentage reduction in all three values, per year, and will be given as a value between 0 and 100.
• final_year= number of the last year to print, e.g. 4 means print years 0, 1, 2, 3, 4. You can assume final year is at least 1.
Notes:
• Use "Year
CHLA
TN
TP for the header row.
• The year should be printed with width 3 (ie, 3d will be helpful)
• CHLA, TN, and TP should be printed with width 10 and 2 decimal places. (Hint: :10.2f will help.)
• You must use a while loop for this - it will help with the next question!
• You cannot use any for loops or list comprehensions.
For example:
Test
print variables_over_time (128, 2048, 256, 12.5, 5)
Result
Year
0
1
2
3
4
5
print_variables_over_time(128, 1024, 256, 6.25, 10) Year
8
1
2
3
4
5
6
7
9
10
CHLA
TN
128.00 2048.00
112.00 1792.00
98.00 1568.00
85.75 1372.00
75.03 1200.50
65.65 1950.44
TP
256.00
224.00
196.00
171.50
150.06
131.30
TP
256.00
240.00
225.00
CHLA
TN
128.00 1024.00
120.00 960.00
112.50 900.00
105.47
843.75
98.88
791.02
92.70 741.58 185.39
86.90
695.23
173.81
81.47 651.78
162.94
76.38
611.04
152.76
71.61
572.85
143.21
67.13
537.05 134.26
210.94
197.75
Transcribed Image Text:Suppose a regional council wants to see the effect of reducing the chorophyll, nitrogen, and phosphorus values in a lake by a certain percentage each year. For example, Lake Whangape could do with a clean up: Define a function print_variables_over_time(c_a, tn_0, tp_0, percent_reduction, final year) that accepts current levels for CHLA, TN, and TP and prints out a table showing a forecast of these values over time, provided all are reduced by the given percentage each year. Parameter summary • c_0, tr_e, and tp_e are initial CHLA, TN, and TP values respectively (i.e. at year 0). • percent_reduction is the percentage reduction in all three values, per year, and will be given as a value between 0 and 100. • final_year= number of the last year to print, e.g. 4 means print years 0, 1, 2, 3, 4. You can assume final year is at least 1. Notes: • Use "Year CHLA TN TP for the header row. • The year should be printed with width 3 (ie, 3d will be helpful) • CHLA, TN, and TP should be printed with width 10 and 2 decimal places. (Hint: :10.2f will help.) • You must use a while loop for this - it will help with the next question! • You cannot use any for loops or list comprehensions. For example: Test print variables_over_time (128, 2048, 256, 12.5, 5) Result Year 0 1 2 3 4 5 print_variables_over_time(128, 1024, 256, 6.25, 10) Year 8 1 2 3 4 5 6 7 9 10 CHLA TN 128.00 2048.00 112.00 1792.00 98.00 1568.00 85.75 1372.00 75.03 1200.50 65.65 1950.44 TP 256.00 224.00 196.00 171.50 150.06 131.30 TP 256.00 240.00 225.00 CHLA TN 128.00 1024.00 120.00 960.00 112.50 900.00 105.47 843.75 98.88 791.02 92.70 741.58 185.39 86.90 695.23 173.81 81.47 651.78 162.94 76.38 611.04 152.76 71.61 572.85 143.21 67.13 537.05 134.26 210.94 197.75
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education