Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Please help me write the code using PYTHON
Transcribed Image Text:**PROBLEM 1: Calculate Sales**
**Function Name:** `calculateSales()`
**Parameters:**
- `item` – a string representing the name of the item for which you want to calculate the total sales
**Return Value:** `str`
**Description:** Given a file, `grocery_sales.csv` (found on canvas and shown in the image below), find the given item and calculate the total sales for that item (i.e., `quantitySold * pricePerItem`). If the item does not exist in the file, the function should return 'Item not found'.
**grocery_sales.csv:**
```
itemName,quantitySold,pricePerItem
Apples,25,0.5
Bread,30,2
Oranges,50,0.6
Milk,40,1.5
Eggs,60,0.2
Cheese,20,3
Tomatoes,35,0.75
Lettuce,45,1
Chicken,10,5
Beef,15,6
Cereals,28,3.5
Rice,50,0.9
Pasta,40,1.25
Chocolate,55,1
Coffee,30,4
```
**Test Cases:**
```python
>>> print(calculateSales("Apples"))
Sales Total: 12ドル.50
>>> print(calculateSales("Bread"))
Sales Total: 60ドル.00
>>> print(calculateSales("Onions"))
Item not found.
```
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
This is a popular solution
bartleby
Trending nowThis is a popular solution!
bartleby
Step by stepSolved in 5 steps with 4 images
Knowledge Booster
Background pattern image
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.Similar questions
- thumb_down Step 1 looking for a simple python script with an explanation of how -(for loops) work. provide code and explanation using requirements below,. Write a program that prints all the factors of a given number and checks whether it is a prime number. The program Asks user for a positive number strictly between 1 and 5000 (both exclusive). Validates that the number is within the range, if not, prompts the user to enter the number again, until user enters a valid number. Prints all the factors, and the total count of factors. (Using either a for loop or a while loop, checks all the numbers less than the input number to see if it is a factor. A number k is a factor of n if n % k == 0 ). Next checks and reports whether the input number is a prime number. ( A prime number is only divisible by two factors : 1 and itself)arrow_forwardwrite some code that repeatedly reads a value into the variable n until a number between 1 and 10 (inclusive) has been entered using a while statement and pythonarrow_forwardWhat will be the python codesarrow_forward
- python:Evaluate the expression 12 % 7arrow_forwardNote: Please do this using Python 3. Here is the text version: Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10A,B,A,C,C,D,E,E,A,DD,B,A,B,C,A,E,E,A,DE,D,D,A,C,B,E,E,A,DC,B,A,E,D,C,E,E,A,DA,B,D,C,C,D,E,E,A,DB,B,E,C,C,D,E,E,A,DB,B,A,C,C,D,E,E,A,DE,B,E,C,C,D,E,E,A,Darrow_forwardhttp://codecheck.it/files/19090511007zak2isnw4afoevi9wybzitkv please help me solve this problem in python (use the link above)arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education