File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -97,13 +97,15 @@ def ContaCaratteri(s):
97
97
D = {} # Costruttore di un dizionario vuoto
98
98
for c in s : # Ciclo su tutti caratteri della stringa
99
99
if c in D :
100
- D [c ] += 1
100
+ D [c ] = D [ c ] + 1 # Equivalente a Ds[c] += 1
101
101
else :
102
102
D [c ] = 1
103
103
return D
104
104
105
105
def CalcolaFrequenza (D ):
106
106
F = {}
107
+ # Commento su builtin 'sum'
108
+ # Link: https://docs.python.org/3/library/functions.html#sum
107
109
tot = sum (D .values ())
108
110
# Soluzione semplice
109
111
for key in D :
@@ -136,7 +138,7 @@ def ComputeTables(Ls):
136
138
for key in sorted (Ls ): # Lista di chiavi, ordine sulle chiavi
137
139
char2int [key ] = idx
138
140
int2char [idx ] = key
139
- idx = idx + 1
141
+ idx = idx + 1 # Equivalente a idx += 1
140
142
return char2int , int2char
141
143
142
144
#-----------------------------------------------
You can’t perform that action at this time.
0 commit comments