Untitled
unknown
python
5 months ago
552 B
10
Indexable
import csv def csvFilter(filename, requiredCalories): # Open the CSV file tupleOutput = ([], []) with open(filename, mode='r', newline='') as file: reader = csv.reader(file, delimiter=',') first = True # Read and print each row for row in reader: if first: first = False continue if len(row) > 4 and row[2] == "H": tupleOutput[0].append(row[0]) if len(row) > 4 and int(row[3]) < requiredCalories: tupleOutput[1].append(row[0]) return tupleOutput
Editor is loading...
Leave a Comment