Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open("task4-input.txt", "r") as file:
- string = file.readline()
- result = ''
- print(string)
- print(ord('D') - ord('C'))
- 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':
- result = 'ERROR'
- elif abs((ord(string[0]) - ord(string[3])) * (int(string[1]) - int(string[4]))) == 2:
- result = 'YES'
- else:
- result = 'NO'
- with open("task4-output.txt", "w") as file:
- file.write(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement