On 24/03/13 07:45, michelle_low wrote:
Can someone please help me with the following phyton script? I
received the error message DeprecationWarning: the sets module is
deprecated
from sets import Set.
I'd like to execute them with unix command
Peter answered both of these.
However, I think there may be a bug in your code...
freqList = []
for symbol in alphabet:
ctr = 0
for sym in stList:
if sym == symbol:
ctr += 1
freqList.append(float(ctr)/len(stList))
Should the last line not be indented to be part of the first for loop?
Otherwise you only store the count for the last symbol.
BTW this could be made simpler:
freqList = []
for symbol in alphabet:
val = float(stList.count(symbol)/len(stlist)
freqList.append(val)
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor