Sample I/O: (Sample run 1) Enter name of the item: Coffee Item: Coffee price: $4.56 (Sample run 2) Enter name of the item: Napkins Item Napkins not found!

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Please help me with this in python. I have attached question and output below.
Sample I/O:
(Sample run 1)
Enter name of the item: Coffee
Item: Coffee price: $4.56
(Sample run 2)
Enter name of the item: Napkins
Item Napkins not found!
Transcribed Image Text:Sample I/O: (Sample run 1) Enter name of the item: Coffee Item: Coffee price: $4.56 (Sample run 2) Enter name of the item: Napkins Item Napkins not found!
Lab Scenarlo:
1. The program runs through the list to search for the item provided by the user.
2. The list Is defined below. Each element of the list is a string in the format of item:price.
You need to separate the item and the price of the wonder by (":").
a. Hint: Remember how you split a string by a delimiter?
b. Example: "this,is, a,string".split(,) #split string by comma
3. It asks the user to enter a string which is a grocery item.
4. If the match is found it will display the price.
5. If it is not matched the program should display the error message as: " Item: <name of
the item> not found".
6. For this lab, you are expected to use for loop to iterate through each item in the list
7. All codes need to be organized in a main function.
8. Sample list:
grocery-["Coffee:$4.56", "Orange Juice:$2.30", "Bread:$3.99", "Potato: $0.97",
"Milk:$5.99", "Tea:$2.99", "Ice cream:$6.99" |
Pseudocode:
1. Start
2. Start Main function
3.
Initialize the grocery list
4.
Initialize a found variable to be False
Prompt user to enter the item
Start for loop iterating through list
Separate item and price
If item is present in list
5.
6.
7.
7.
8.
Print item name and its price
9.
Set found variable to be True
10.
If found variable is False
11.
Print item not found message
12. End main function
13. End
Transcribed Image Text:Lab Scenarlo: 1. The program runs through the list to search for the item provided by the user. 2. The list Is defined below. Each element of the list is a string in the format of item:price. You need to separate the item and the price of the wonder by (":"). a. Hint: Remember how you split a string by a delimiter? b. Example: "this,is, a,string".split(,) #split string by comma 3. It asks the user to enter a string which is a grocery item. 4. If the match is found it will display the price. 5. If it is not matched the program should display the error message as: " Item: <name of the item> not found". 6. For this lab, you are expected to use for loop to iterate through each item in the list 7. All codes need to be organized in a main function. 8. Sample list: grocery-["Coffee:$4.56", "Orange Juice:$2.30", "Bread:$3.99", "Potato: $0.97", "Milk:$5.99", "Tea:$2.99", "Ice cream:$6.99" | Pseudocode: 1. Start 2. Start Main function 3. Initialize the grocery list 4. Initialize a found variable to be False Prompt user to enter the item Start for loop iterating through list Separate item and price If item is present in list 5. 6. 7. 7. 8. Print item name and its price 9. Set found variable to be True 10. If found variable is False 11. Print item not found message 12. End main function 13. End
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY