Advertisement
Guest User

Untitled

a guest
Dec 4th, 2022
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. myfile = 'list.txt'
  2. fh = open(myfile,'r')
  3. calorie = 0
  4. highest_cal = 0
  5. for line in fh:
  6. if (line.isspace()) == True:
  7. if (calorie>highest_cal):
  8. highest_cal = calorie
  9. print(calorie)
  10. calorie = 0
  11. else:
  12.  
  13. calorie+= int(line)
  14.  
  15.  
  16. print(highest_cal)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement