Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- with open('input.txt', mode='r') as f:
- happy_ticket_count = 0
- total_sum = 0
- total_count = 0
- for line in f:
- s = line.rstrip()
- s = list(map(float, s))
- sum1 = sum(s[:3], 0)
- sum2 = sum(s[3:], 0)
- total_sum += sum1 + sum2
- if sum1 == sum2:
- happy_ticket_count += 1
- total_count +=1
- with open('output.txt', mode='a') as f:
- f.write(str(happy_ticket_count)+'\n')
- f.write((format((total_sum/(total_count*6)), '.2f')))
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement