Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume, you have been given a string that contains a few products name, prices, and, costing respectively, and an integer value as a budget for

Assume, you have been given a string that contains a few products name, prices, and, costing respectively, and an integer value as a budget for shopping. Now, write a python program that will calculate the total costing of products from the given string and check whether it is possible to buy those products while being within the budget. If the total costing is greater than the budget, then print Shopping not possible. Otherwise, print Yay!! Shopping possible. If the quantity of any of the products is less than 1, then print Quantity must be greater than 0. ====================================================== Given 1: data = "Apples,5,2,Oranges,10,1,Eggs,3,5" budget= 70 Sample Output 1: Costing in dictionary: {'Apples': 10, 'Oranges': 10, 'Eggs': 15} Total costing: 35 Total Budget: 70 Yay!! Shopping possible Explanation 1: The 1st product is Apples, and each apple costs 5 takas and 2 is the buying quantity of apples. So, the cost of apples is 5*2=10 taka. The 2nd product is Oranges, and each orange costs 10 takas, and 1 is the buying quantity of oranges. So, the cost of Orange is 10*1=10 taka. The 3rd product is Eggs, and each egg costs 3 takas and 5 is the buying quantity of eggs. So, the cost of eggs is 3*5=15 taka. So, total costing= 10+10+15=35 taka which is less than the budget of 70. So, You can buy these items. ====================================================== Given 2: data = "Apples,5,2,Oranges,10,0,Eggs,3,5" budget= 70

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

=+ What are the new equilibrium interest rate and level of income?

Answered: 1 week ago