Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. with open("task4-input.txt", "r") as file:
  2. string = file.readline()
  3. result = ''
  4. print(string)
  5. print(ord('D') - ord('C'))
  6. if len(string) != 5 or string[2] != '-' or string[0]<'A'or string[0]>'H' or string[3]<'A'or string[3]>'H' or string[1]<'1'or string[1]>'8' or string[4]<'1' or string[4]>'8':
  7. result = 'ERROR'
  8. elif abs((ord(string[0]) - ord(string[3])) * (int(string[1]) - int(string[4]))) == 2:
  9. result = 'YES'
  10. else:
  11. result = 'NO'
  12.  
  13. with open("task4-output.txt", "w") as file:
  14. file.write(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement