advanced python programming questions

1. The Product.csv contains over 400 products. Here is a representative sample:

00100100011000,Apple sauce,20.77
00101111001100,Brownies,18.76
01010011111111,Chips,13.34

1st field is the “Barcode”, where 0 represents a narrow strip and 1 is a wide strip.
2nd field is the Product Name.
3rd field is the product Price.

Create a User Defined Type to hold this data. Each line in the data file Products.csv corresponds to a product. Read each line of the data in the file, create a product and strore the product in a Dictionary. The Key to the Product is the Barcode, and the Value is the Product Name and Price.

The Carts.csv contains multiple Products, and each of the Products in the Cart are represented by a barcode. Here is a representative sample:

01010100001000,01000011101000,01011110111011,00010100001100
10000101110100,10011010111001
00110000010001,01001001111101,01001011011011

Process each Barcode in the Cart by looking up the Product Name and Price in the Product Dictionary. After retrieving the Product information for the Barcode, print the Product Name and Price. At the end of processing the Cart, print the total cost for all the Products in the Cart.

We’ve determined that the lookup program in Python uses a linear search to find items. A more efficient algorithm is the Binary Search Algorithm, listed here:

low = 0
high = len(numbers) – 1

while high >= low:
mid = (high + low) // 2
if numbers[mid] < key:
low = mid + 1
elif numbers[mid] > key:
high = mid – 1
else:
return mid
return -1 # not found

To see if the Binary Search algorithm IS faster than a linear search, sort the Product List by Barcode as it’s sorted by Product Name now. Binary Searches only work on sorted data. Then call the Binary Search algorithm. You should see a difference in processing time.

2. Draw a frequency bar chart. Refer to picture

Files are attached

 

“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!
Use Discount Code “Newclient”for a 15% Discount!”

We have Walden University and Capella University nursing practitioners!


Buy Custom Nursing Papers

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational