Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- errors=0
- with open("input.txt") as file:
- for line in file:
- s=len(line.strip())//2
- com1, com2 = line[:s], line[s:]
- for i in com1:
- if i in com2:
- if i.isupper():
- errors+=ord(i)-38
- else:
- errors+=ord(i)-96
- break
- print(errors)
- ##################################################################################################
- #!/usr/bin/env python3
- badges=0
- with open("input.txt") as file:
- text=file.read().split()
- def same(one, two, *three):
- same=set()
- for char in one:
- # if (char in two) and (char in three):
- if char in two:
- same.add(char)
- return(same)
- for i in range(3, len(text)+1, 3):
- one=text[i-3]
- two=text[i-2]
- three=text[i-1]
- group=same(same(one,two),same(two,three)).pop()
- # group=same(one, two, three).pop()
- if group.isupper():
- badges+=ord(group)-38
- else:
- badges+=ord(group)-96
- print(badges)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement