SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. s = "Hello Python!"
  2.  
  3. print(s.count('o'))
  4. # output : 2
  5.  
  6. print(s.count('h'))
  7. # output : 1
  8. # case sensitive: 'H' is not counted as an occurrence of 'h'
  9.  
  10. print(s.count('Py'))
  11. # output : 1
  12.  
  13. print(s.count('x'))
  14. # output : 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top