def deleteFood():
print('Enter food name')
food = input().lower()
with open("FoodList.txt") as f:
lines = f.readlines()
for i in range(len(lines)-1):
if food in lines[i]:
print('Deleting ' + lines[i] + lines[i+1] + lines [i+2] + lines [i+3] + 'Confirm? Y/N')
confirmation = input().upper()
if confirmation == 'Y' or confirmation == 'N':
if confirmation == 'Y':
I cant seem to find a solution for this. I want to delete lines[i] up to lines[i+3] if confirmed. This is a part of a much bigger calorie tracking program