Advertisement
Guest User

Untitled

a guest
May 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. def count_c(s, c):
  2. if len(s)==0:
  3. return
  4. if s[0]==c:
  5. return 1 + count_c(s[1:], c)
  6. else:
  7. return 0 + count_c(s[1:], c)
  8.  
  9. print('the number of letters is: ' + count_c('ciao amico come cacchio stai?','c'))
  10. print('the number of letters is: ' + count_c('ccc','c'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement