Untitled
unknown
python
a year ago
552 B
17
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 tupleOutputEditor is loading...
Leave a Comment