Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- T = int(input())# the target number
- N =int(input()) # the number of words to follow
- word = input().lower()
- word2=input().lower()
- word3=input().lower()
- output = sum([ord(c)-96 for c in word])
- distance=abs(output-T)
- output2=sum([ord(c)-96 for c in word2])
- distance2=abs(output2-T)
- output3=sum([ord(c)-96 for c in word3])
- distance3=abs(output3-T)
- average_distance=(distance+distance2+distance3)/3
- print(f'{word} {distance}')
- print(f'{word2} {distance2}')
- print(f'{word3} {distance3}')
- print(f'{average_distance:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement