Advertisement
vivaladiva

Untitled

Nov 18th, 2020 (edited)
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. def sumOfItems(file):
  5.     result = 0
  6.  
  7.     lines = file.readlines()
  8.  
  9.     for line in lines:
  10.         result = result + sum(map(
  11.             lambda x: int(x),
  12.             filter(lambda x: x.isdigit(), line.rstrip().split(","))
  13.         ))
  14.  
  15.     return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement