Entropy/Narcissist: Difference between revisions

m
Now it works with arbitary filename
(Added Kotlin)
m (Now it works with arbitary filename)
Line 440:
return -sum( count/lns * math.log(count/lns, 2) for count in p.values())
 
with open('c:/E.py'__file__) as f:
b=f.read()
print(entropy(b))</lang>
{{Output}}
<pre>4.57672378235371575438063744619</pre>
 
=={{header|Racket}}==
Anonymous user