#question is asking to find the average number of orders from the given CVS file.
#this is what I got so far
import csv
count = 0
total = 0
with open('sales_data_sample.csv', 'r') as csvFile:
csvFile = csv.reader(csvFile)
next(csvFile)
for line in csvFile:
count += 1
total = total + line[1]
avg = total / count
print(avg)
Asked
Active
Viewed 13 times
0
bereal
- 29,394
- 6
- 53
- 86
-
You convert a string to an int using the `int()` function. You also need to initialize `count` and `total` in your code to 0. – Frank Yellin Nov 14 '21 at 18:17