I have tried to understand problem number 6 (below) from quiz 1.
I dont understand what "d.keys()" does/mean?
I dont get d[k] = 0 means? Is k indexing to 0?
I dont understand why d2 has d2 in one of the parameters.
def f(s, d):
for k in d.keys():
d[k] = 0
for c in s:
if c in d:
d[c] += 1
else: d[c] = 0
return d
def addUp(d):
result = 0
for k in d:
result += d[k]
return result
d1 = {}
d2 = d1
d1 = f('abbc', d1)
print addUp(d1)
d2 = f('bbcaa', d2)
print addUp(d2)
print f('', {})
print result
6.1) What does it print? (9 points)

Hey! We 've verified this expert answer for you, click below to unlock the details :)

I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!

should i type it using pastebin

Looking for something else?

Not the answer you are looking for? Search for more explanations.

## More answers

Looking for something else?

Not the answer you are looking for? Search for more explanations.