>>> from phone import ncalls1 >>> v1 = ['934780245', '012', '618776611', '972399700', '11811', ... '972399700', '012', '938765454', '012', '11811', '012', '11811'] >>> with open ('calls.txt', 'w') as f: ... for e in v1: ... a = f.write (e + '\n') >>> ncalls1('calls.txt') (4, 3)