Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. #Frequency analysis: print the list of pairs (character, number of occurrences) found in a given string
  2.  
  3. def fa(string):
  4.     alp="abcdefghijklmnopqrstuvwxyz"
  5.     for i in range(0, len(alp)):
  6.         if string.count(alp[i]) >0:
  7.             print('('+ alp[i]+','+ string.count(alp[i])+') ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement