[Tutor] another better way to do this ?
Roelof Wobben
rwobben at hotmail.com
Sat Jan 11 22:24:56 CET 2014
Hello,
I try to learn python by following the audicity page.
Now I have the following problem.
I have two strings a and b
Now I have to check if the characters of b are all in a.
But they do have to be in the same order.
So I thought about this solution.
length = len(b)
start = 1
while start < length :
check = a.find (b[start])
if check == -1 :
return False
start = start + 1
return True
But according to the site this can be solved in a one-liner.
So can someone give me pointers how this can be done and if my solution can work.
Roelof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140111/9eca37a9/attachment.html>
More information about the Tutor
mailing list