40 lines
683 B
Python
40 lines
683 B
Python
import sys
|
|
import os
|
|
from pprint import pprint
|
|
import time
|
|
import math
|
|
|
|
#colors
|
|
from termcolor import colored
|
|
|
|
grid = []
|
|
|
|
input_f = ''
|
|
if len(sys.argv) == 1:
|
|
input_f = 'test'
|
|
else:
|
|
input_f = sys.argv[1]
|
|
|
|
with open(input_f) as file:
|
|
for line in file:
|
|
grid = line.rstrip().split(',')
|
|
|
|
print(grid)
|
|
values = []
|
|
current_value = 0
|
|
|
|
for i in grid:
|
|
value = 0
|
|
for j in list(i):
|
|
current_value += value
|
|
#print(j)
|
|
current_value += ord(j)
|
|
current_value *= 17
|
|
current_value %= 256
|
|
#print(current_value)
|
|
value = current_value
|
|
current_value = 0
|
|
print(value)
|
|
values.append(value)
|
|
|
|
print(sum(values)) |