Advertisement
stefano_p

control_string_boolean

May 22nd, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. def control_string_boolean(stringA,stringB,N):
  2. #@ param stringA : string con lungha 1
  3. #@ param stringB : string
  4. #@ param N : int
  5.    
  6.    S=stringA in stringB
  7.    if not stringA in stringB and N==0:
  8.      return true
  9.    elif stringA in stringB and N==0:
  10.      return false  
  11.    if stringA in stringB:
  12.      I=stringB.find(stringA)
  13.      stringB=stringB[0:I]+stringB[I+1:]
  14.      
  15.    if N>1:
  16.       #print"vuoi sapere se la stringa '%s' e' presente per la %i volta nella stringa  '%s'" %(stringA,N,stringB)
  17.       return control_string_boolean(stringA,stringB,N-1)
  18.  
  19.    return S
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement