Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('N9.txt')
- lines = f.readlines()
- f.close()
- #print(lines[0], lines[1], lines[2])
- def f(a):
- for i in a:
- if i < 1 or i > 8:
- return 0
- x1 = a[0]
- y1 = a[1]
- x2 = a[2]
- y2 = a[3]
- dx = abs(x1 - x2)
- dy = abs(y1 - y2)
- A = min(dx,dy)
- B = max(dx,dy)
- return A == 1 and B == 2
- k = 0
- for line in lines:
- a = [int(i) for i in line.split()]
- if f(a):
- k += 1
- print(a)
- print(k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement