Question: Multiple Choice: Refer to the following code, what will the print statement on line 7 display? - - - - - - - - -

Multiple Choice:
Refer to the following code, what will the print statement on line 7 display?
-----------------------------------------------------------------------------------------
flowers ={"white": "lily",
"red": "rose",
"blue": "carnation",
"yellow": "buttercup"}
colors = list(flowers.keys())
colors.sort()
show_colors = "Colors of flowers: "
for color in colors:
show_colors += color +""
print(show_colors)
pick_color = input("Enter a color: ")
pick_color = pick_color.lower()
if pick_color in flowers:
name = flowers[pick_color]
print("Flower name: "+ name)
else:
print("There is no "+ pick_color +" flower.")
Multiple Choice:
Refer to the following code, what will the print statement on line 7 display?
-----------------------------------------------------------------------------------------
flowers ={"white": "lily",
"red": "rose",
"blue": "carnation",
"yellow": "buttercup"}
colors = list(flowers.keys())
colors.sort()
show_colors = "Colors of flowers: "
for color in colors:
show_colors += color +""
print(show_colors)
pick_color = input("Enter a color: ")
pick_color = pick_color.lower()
if pick_color in flowers:
name = flowers[pick_color]
print("Flower name: "+ name)
else:
print("There is no "+ pick_color +" flower.")
Colors of flowers: white red blue yellow
Colors of flowers: lily rose carnation buttercup
Colors of flowers: buttercup carnation lily rose
Colors of flowers: blue red white yellow

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!