Advertisement
CR7CR7

BibkaAndAngel

May 17th, 2022
796
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. T = int(input())# the target number
  2. N =int(input()) # the number of words to follow
  3. word = input().lower()
  4. word2=input().lower()
  5. word3=input().lower()
  6.    
  7. output = sum([ord(c)-96 for c in word])
  8. distance=abs(output-T)
  9.  
  10. output2=sum([ord(c)-96 for c in word2])
  11. distance2=abs(output2-T)
  12.  
  13. output3=sum([ord(c)-96 for c in word3])
  14. distance3=abs(output3-T)
  15.  
  16.  
  17.  
  18.            
  19. average_distance=(distance+distance2+distance3)/3
  20.  
  21. print(f'{word} {distance}')
  22. print(f'{word2} {distance2}')
  23. print(f'{word3} {distance3}')
  24. print(f'{average_distance:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement