Store the plants words and their planting seasons in a dictionary Prompt the user to enter the name of a plant they want to look up. If the plant exists in the dictionary, print its planting season. Your program should be case insensitive e.g. both "cabbage" and "CABBAGE" should print "spring or late summer". If the word does not exist in the dictionary, print a message telling the user that you don't have the information they're looking for. Continue to prompt the user to enter a plant name to look up until they enter "q" to quit the program.
Store the plants words and their planting seasons in a dictionary Prompt the user to enter the name of a plant they want to look up. If the plant exists in the dictionary, print its planting season. Your program should be case insensitive e.g. both "cabbage" and "CABBAGE" should print "spring or late summer". If the word does not exist in the dictionary, print a message telling the user that you don't have the information they're looking for. Continue to prompt the user to enter a plant name to look up until they enter "q" to quit the program.
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2PE
Related questions
Question
For this problem, you will write part of a Python program that will tell the user when to plant certain edible plants in their garden. The plants and their planting seasons are shown in the table below:
Plant | Season |
blueberry | fall or spring |
tomato | spring |
pumpkin | late spring |
cabbage | spring or late summer |
strawberry | early spring |
Your code should:
- Store the plants words and their planting seasons in a dictionary
- Prompt the user to enter the name of a plant they want to look up.
- If the plant exists in the dictionary, print its planting season. Your program should be case insensitive e.g. both "cabbage" and "CABBAGE" should print "spring or late summer".
- If the word does not exist in the dictionary, print a message telling the user that you don't have the information they're looking for.
- Continue to prompt the user to enter a plant name to look up until they enter "q" to quit the program.
Example input / output (User input in blue)
Enter a plant name: Pumpkin
late spring
Enter a plant name: bacon
I don't know when to plant bacon.
Enter a plant name: q
Expert Solution
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 2 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
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT