Home > other >  The small white questions
The small white questions

Time:09-26


Want to ask is how can also determine the 'a', 'b', 'c' is in s?
Just started to learn, no foundation, so have asked this

CodePudding user response:

Print (' a 'and' b 'and' c 'in s) returns true is in

CodePudding user response:

Make a loop, in turn, determine.
The pattern='ABC'
S='1 a2b3c'
For the index in the range (len (pattern) :
If the pattern [index] in s:
Pass
The else:
Return False
Return True

Probably is such, code not tested, it might be a little small bug, thinking is

CodePudding user response:

 s='1 a2b3c' 
(' a 'print (s) in the and (' b' s in) and (s) in 'c')
  • Related