[Tutor] Week 10 warmup assignment

Daniella Sapozhnikova daniellasapo at gmail.com
Thu Mar 31 23:26:38 EDT 2016


Umm I'm new to this whole tutoring list and I'm having a little bit of
trouble in school with my programming classes (hopefully it's not too late
to pass my class) but anyway, here's the code I've written:


#!/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: 374362,
        0: 326226,
        -15: 417203,
        -56: 333525,
        67: 323451,
        99: 321696,
        21: 336753,
        -100: 361237,
        55: 1209714,
        5150: 1771800,
        42: 4714011,
        888: 14817667,
        3500: 13760234,
        712: 10903322,
        7: 10443792,
        842: 11716264,
        18584: 10559923,
        666: 9275602,
        70: 11901200,
        153: 12074784,
        8: 4337229}


def iter_dict_funky_sum(**DATA):
    """function that takes one dictionary argument declaring
    a running total variable, extracting key/value pairs from
    DATA simultaneously in a for loop, assigning and appending
    the product of the value minus the key to the running total
    variable and returning the total."""
    funky = 0
    for key, value in DATA.iteritems():
        funky += value - key
    return funky


Now, everything it's returning is correct, the only problems I'm having is
the 2 errors pylint is throwing me, which are:
task_07.py:36: [W0621(redefined-outer-name), iter_dict_funky_sum]
Redefining name 'DATA' from outer scope (line 7)
task_07.py:36: [C0103(invalid-name), iter_dict_funky_sum] Invalid argument
name "DATA"

What does it mean and how can I fix it?


More information about the Tutor mailing list