daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def isIn(char, aStr):
  2.     '''
  3.     char: a single character
  4.     aStr: an alphabetized string
  5.  
  6.     returns: True if char is in aStr; False otherwise
  7.     '''
  8.     # Your code here
  9.     if len(aStr) <= 1 and aStr != char :
  10.         return False
  11.     elif aStr[len(aStr) / 2] == char :
  12.         return True
  13.     elif char < aStr[len(aStr) / 2] :
  14.         return isIn(char, aStr[:len(aStr) / 2])
  15.     else :
  16.         return isIn(char, aStr[len(aStr) / 2:])
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
 
Top