Tuesday, 13 August 2013

howt to use 'in' in python, with length constraint

howt to use 'in' in python, with length constraint

ss = ''
for word in ['this','his','is','s']: # Attach the words
if word not in ss: # if they are not already
present
ss = ss + word + ' ' # to ss(substring) AFTER ss.
It gives output as: 'this '
But I want to get: 'this his is s '
How to do it using 'in' keyword?

No comments:

Post a Comment