On 02/04/16 10:59, Albert-Jan Roskam wrote:
>>> however now pylint is returning:
>>> task_07.py:36: [W0102(dangerous-default-value), iter_dict_funky_sum]
>>> Dangerous default value DATA (__builtin__.dict) as argument
>> I would drop the default value for the parameter.
>> ( I suspect that Python
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Sat, 2 Apr 2016 09:08:04 +0100
> Subject: Re: [Tutor] Alan G Week 10 warmup assignment help
>
> On 02/04/16 02:21, Daniella Sapozhnikova wrote:
> > I changed the file to this:
>
> > DATA = {2:
On 02/04/16 02:21, Daniella Sapozhnikova wrote:
> I changed the file to this:
> DATA = {2: 7493945,
> 76: 4654320,
...
> 153: 12074784,
> 8: 4337229}
>
> def iter_dict_funky_sum(data=DATA):
> funky = 0
> for key, value in data.iteritems():
> funky += value
I changed the file to this:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Task 07: declaring a dictionary, creating a function,
return a funky total """
DATA = {2: 7493945,
76: 4654320,
3: 4091979,
90: 1824881,
82: 714422,
45: 1137701,
10: 37436