Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. fin = open('input.txt', 'r', encoding='utf8')
  2. handle = open("output.txt", "w")
  3. data = fin.read()
  4. my_list = list(data)
  5. #data='2002'
  6. if len(my_list) == 4:
  7.     if my_list[0] == my_list[3] and my_list[1] == my_list[2]:
  8.         handle.write(1)
  9.     else:
  10.         handle.write(0)
  11. else:
  12.     handle.write(0)
  13.  
  14. handle.close()
  15. fin.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement