a guest Sep 15th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def isOneSwapEnough(s):
  2.     for i in range(len(s)):
  3.         for j in range(i, len(s)):
  4.             l = list(s)
  5.             temp = l[i]
  6.             l[i] = l[j]
  7.             l[j] = temp
  8.             a = "".join(l)
  9.             print(a)
  10.             if a == a[::-1]:
  11.                 return True
  12.     return False
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand