Advertisement
aar6947

edX Python 6.00x: Pset1 P2

Jun 23rd, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. soma = 0
  2. word1 = "bob"
  3.  
  4. for ans in range(0, (len(s)-2)):
  5.     if s[ans] == "b" and s[ans+1] == "o" and s[ans+2] == "b":
  6.         soma += 1
  7.  
  8. print("Number of times bob occurs is: "+str(soma))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement