I don't understand how to fix my code so that highlighted marks are corrected my code is my python. I have an example input and what the expected output should be and what I get as my output but they don't match how do I fix this
I don't understand how to fix my code so that highlighted marks are corrected my code is my python. I have an example input and what the expected output should be and what I get as my output but they don't match how do I fix this
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
Related questions
Question
I don't understand how to fix my code so that highlighted marks are corrected my code is my python. I have an example input and what the expected output should be and what I get as my output but they don't match how do I fix this.
![1 print(' '==> Bull Kelp and Purple Urchin Population Simulator <==\n')
2 print('--
--- Model Parameters ---')
3
4 a = float(input("Kelp growth rate: "))
5 if a < 0:
6
7
print("\nError: cannot have a negative growth rate")
exit()
8
9 b = float(input("\nKelp death rate: "))
10 if b < 0:
11
12
38
39
40
41
12
print("\nError: cannot have a negative death rate")
exit()
13
14 c = float(input("\nUrchin birth rate: "))
15 if c < 0:
16
17
18
19 d = float(input("\nUrchin death rate: "))
20 if d < 0:
21
22
23
24 KØ max(0, float(input()))
25 u0 max(0, float(input()))
26
27 print()
28 print('\n--- Initial Population ---')
29 print (f"Kelp population (in thousands) at t = 0: ")
30 print (f"Urchin population (in thousands) at t = 0: ")
31 print()
32 print('--- Simulation ---')
33
34 for t in range (2):
35
k
36
37
print("\nError: cannot have a negative birth rate")
exit()
print("\nError: cannot have a negative death rate")
exit()
k0 + (a *k0 * (1 (k0 / 100))) - (b* k0)
u = u * (1 + c)
(d * u * k0 / (k0 + 100))
k
max(0, k0)
u = max(0, u0)
print(f"Time t = {t}: {k:.3f}k kelp, {u:.3f}k urchins")
ko
k
u0 = U
=
=
=](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F775c65b2-d298-4974-84c2-1b9ec352df93%2Fd60b9acd-16f7-4065-bc70-5e62852609ee%2F7aijthr_processed.png&w=3840&q=75)
Transcribed Image Text:1 print(' '==> Bull Kelp and Purple Urchin Population Simulator <==\n')
2 print('--
--- Model Parameters ---')
3
4 a = float(input("Kelp growth rate: "))
5 if a < 0:
6
7
print("\nError: cannot have a negative growth rate")
exit()
8
9 b = float(input("\nKelp death rate: "))
10 if b < 0:
11
12
38
39
40
41
12
print("\nError: cannot have a negative death rate")
exit()
13
14 c = float(input("\nUrchin birth rate: "))
15 if c < 0:
16
17
18
19 d = float(input("\nUrchin death rate: "))
20 if d < 0:
21
22
23
24 KØ max(0, float(input()))
25 u0 max(0, float(input()))
26
27 print()
28 print('\n--- Initial Population ---')
29 print (f"Kelp population (in thousands) at t = 0: ")
30 print (f"Urchin population (in thousands) at t = 0: ")
31 print()
32 print('--- Simulation ---')
33
34 for t in range (2):
35
k
36
37
print("\nError: cannot have a negative birth rate")
exit()
print("\nError: cannot have a negative death rate")
exit()
k0 + (a *k0 * (1 (k0 / 100))) - (b* k0)
u = u * (1 + c)
(d * u * k0 / (k0 + 100))
k
max(0, k0)
u = max(0, u0)
print(f"Time t = {t}: {k:.3f}k kelp, {u:.3f}k urchins")
ko
k
u0 = U
=
=
=
![Output differs. See highlights below.
Input
Your output
Expected output
1.5
.001
.05
2.5
100
2
==> Bull Kelp and Purple Urchin Population Simulator <==
Kelp growth rate:
Kelp death rate:
Urchin birth rate:
Urchin death rate:
Model Parameters
Initial Population
Kelp population (in thousands) at t = 0:
Urchin population (in thousands) at t = 0:
Simulation
Time t = 0: 100.000k kelp, 2.000k urchins
Time t = 1: 100.000k kelp, 2.000k urchins
==> Bull Kelp and Purple Urchin Population Simulator <==
Kelp growth rate:
Kelp death rate:
Urchin birth rate:
Urchin death rate:
‒‒‒
Model Parameters
Initial Population
Kelp population (in thousands) at t = 0:
Urchin population (in thousands) at t = 0:
‒‒‒
Simulation
Time t = 0: 100.000k kelp, 2.000k urchins
Time t = 1: 249.800k kelp, 7.000 k urchins](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F775c65b2-d298-4974-84c2-1b9ec352df93%2Fd60b9acd-16f7-4065-bc70-5e62852609ee%2F7kaz9xb_processed.png&w=3840&q=75)
Transcribed Image Text:Output differs. See highlights below.
Input
Your output
Expected output
1.5
.001
.05
2.5
100
2
==> Bull Kelp and Purple Urchin Population Simulator <==
Kelp growth rate:
Kelp death rate:
Urchin birth rate:
Urchin death rate:
Model Parameters
Initial Population
Kelp population (in thousands) at t = 0:
Urchin population (in thousands) at t = 0:
Simulation
Time t = 0: 100.000k kelp, 2.000k urchins
Time t = 1: 100.000k kelp, 2.000k urchins
==> Bull Kelp and Purple Urchin Population Simulator <==
Kelp growth rate:
Kelp death rate:
Urchin birth rate:
Urchin death rate:
‒‒‒
Model Parameters
Initial Population
Kelp population (in thousands) at t = 0:
Urchin population (in thousands) at t = 0:
‒‒‒
Simulation
Time t = 0: 100.000k kelp, 2.000k urchins
Time t = 1: 249.800k kelp, 7.000 k urchins
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 4 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education