I'm taking MIT 6.00.1x from edX.org and I'm on problem set 1 problem 2. I'm having trouble getting bob from this variable
s = 'azcbobobegghakl'
I have this code
s = 'azcbobobegghakl'
bobTimes = 0
for bobWord in s:
if 'b' and 'o' and 'b' in bobWord:
bobTimes += 1
print(bobTimes)
The code works for this variable, but when you add on another b and o, like this:
s = 'azcbobobegghaklbobddbtto'
It adds one to the bobTimes
variable. I don't see how I can extract the word 'bob' from this variable.