Advertisement
Guest User

Check halves

a guest
Apr 3rd, 2020
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. Def check_halves(s)
  2.  S1=s[0:len(s)//2
  3.  S2=s[len(s)//2:len(s)
  4.  
  5.  If not s1 or s2:
  6.   Return 0
  7.  Elif len(s1) == 1 and len(s2) == 1 and s1 == s2:
  8.   Return 1
  9.  Elif s1[0] != s2[0]:
  10.   Return 0
  11.  Else:
  12.   Return check_halves(s1[1:]+s2[1:])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement