Saturday 15 March 2014

python - I'm having trouble with the for(x) in (y) function -


So I'm currently trying to define a function that looks at two strings and tells the user if A string is located in the other, it looks like this:

  def isIn (x, y): y in y: if x == y: print "true" print y in y "And: print" wrong "in y: x: if x == y: print" true "print" y in x "other: print is" wrong "('5', '1')   

I think there is something to do with the (y) function, for this But I may be wrong. Continuing with the code:

  y in true y in true y   

Any suggestion how can I fix it?

I think that for you ... in the just plain Confused with in ; Def isIn (x, y): if x in y: print "true" print "y in y" else: print "wrong" if y x: print "true" print "y In x "else: print" false "isIn ('5', '1')

No comments:

Post a Comment