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
icon
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
=
=
=
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
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
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
  • SEE MORE 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