I need a break in the output code. my code is all together
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 need a break in the output code. my code is all together
![1 class Plant:
2
# Class representing a plant with its name and cost
4 definit__(self, name, cost):
5
6
7
8
9
10
11
12
20
21
22
23
24
25
13
14
15
16
17 class Flower(Plant):
18
# Class representing a flower, which is a sub-class of Plant
19
26
27
28
29
30
31
32
33
34
35
36
37
38
# Constructor for the Plant class
# name: the name of the plant (string)
#cost: the cost of the plant (integer)
self.name = name # assign the name of the plant
self.cost = cost # assign the cost of the plant
def print_info(self):
print(" Plant name:", self.name)
Cost:", self.cost)
print("
53
54
55
56
57
58
def __init__(self, name, cost, annual, color):
# Constructor for the Flower class
# name: the name of the flower (string)
# cost: the cost of the flower (integer)
# annual: whether the flower is annual or not (string)
#color: the color of the flower (string)
Plant__init__(self, name, cost) # call the parent class constructor
self.annual annual # assign the annual property
self.color color # assign the color property
def print_info(self):
# Function to print the information of the flower
print(" Plant name:", self.name)
Cost:", self.cost)
print("
print(" Annual: ", self.annual)
print("
Color of flowers:", self.color)
39
40 def print_list(plants):
41 # Function to print information about a list of plants
42
43
44
45
46
47
48 my_garden = [] # list to store the plants in the garden
49
for i, plant in enumerate (plants):
print("Plant", i+ 1, "Information:")
plant.print_info()
50 # Read user input to create plants and flowers
51 while True:
52
line input().strip().split()
if line [0] == "-1":
break
if line [0] == "plant":
my_garden.append(Plant (line [1], int(line[2])))
elif line [0] == "flower":
my_garden.append(Flower (line [1], int(line[2]), line [3], line[4]))
59
60 print()
61 # Call the function to print the information of all plants
62 print_list(my_garden)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa332979b-3709-48a2-942a-205e2ae2d053%2F7ca92ed6-fd8e-498c-842c-9df53fcbf2ec%2Ftmh9lt7_processed.png&w=3840&q=75)
Transcribed Image Text:1 class Plant:
2
# Class representing a plant with its name and cost
4 definit__(self, name, cost):
5
6
7
8
9
10
11
12
20
21
22
23
24
25
13
14
15
16
17 class Flower(Plant):
18
# Class representing a flower, which is a sub-class of Plant
19
26
27
28
29
30
31
32
33
34
35
36
37
38
# Constructor for the Plant class
# name: the name of the plant (string)
#cost: the cost of the plant (integer)
self.name = name # assign the name of the plant
self.cost = cost # assign the cost of the plant
def print_info(self):
print(" Plant name:", self.name)
Cost:", self.cost)
print("
53
54
55
56
57
58
def __init__(self, name, cost, annual, color):
# Constructor for the Flower class
# name: the name of the flower (string)
# cost: the cost of the flower (integer)
# annual: whether the flower is annual or not (string)
#color: the color of the flower (string)
Plant__init__(self, name, cost) # call the parent class constructor
self.annual annual # assign the annual property
self.color color # assign the color property
def print_info(self):
# Function to print the information of the flower
print(" Plant name:", self.name)
Cost:", self.cost)
print("
print(" Annual: ", self.annual)
print("
Color of flowers:", self.color)
39
40 def print_list(plants):
41 # Function to print information about a list of plants
42
43
44
45
46
47
48 my_garden = [] # list to store the plants in the garden
49
for i, plant in enumerate (plants):
print("Plant", i+ 1, "Information:")
plant.print_info()
50 # Read user input to create plants and flowers
51 while True:
52
line input().strip().split()
if line [0] == "-1":
break
if line [0] == "plant":
my_garden.append(Plant (line [1], int(line[2])))
elif line [0] == "flower":
my_garden.append(Flower (line [1], int(line[2]), line [3], line[4]))
59
60 print()
61 # Call the function to print the information of all plants
62 print_list(my_garden)

Transcribed Image Text:1:Compare output
Output is nearly correct, but whitespace differs. See highlights below. Special character legend
Input
Your output
Expected output
2:Compare output
plant Spirea 10
flower Hydrangea 30 false lilac.
flower Rose 6 false white
plant Mint 4
-1
Input
Plant 1 Information:
Plant name: Spirea
Cost: 10
Plant 2 Information:
Plant name: Hydrangea
Cost: 30
Plant 3 Information:
Plant name: Rose
Cost: 6
Annual: false.
Color of flowers: white
Annual: false.
Color of flowers: lilac
Plant 4 Information:
Plant name: Mint
Cost: 4
ܢܢ
Plant 1 Information:
Plant name: Spirea
Cost: 10
H
Plant 2 Information:
Plant name: Hydrangea
Cost: 30
Annual: false
Color of flowers: lilac
Plant 3 Information:
Plant name: Rose
Cost: 6
Annual: false
Color of flowers: white
H
Plant 4 Information:
Plant name: Mint
Cost: 4
Output is nearly correct, but whitespace differs. See highlights below. Special character legend
plant Basil 4
plant Thyme 4
flower Peony 30 false pink
flower Marigold 6 false orange
plant Juniper 10
-1
Plant 1 Information:
Plant name: Basil
Cost: 4
Plant 2 Information:
Plant name: Thyme
0/2
0/2
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps

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
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education