Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (120 points)

def variable_subsitution(textdic): 

        for x, y in dic.items(): 

                text = text.replace(x,y) 

                return text

variable="Michael"

txt=variable_subsitution("Michaek","Michael")

Traceback (most recent call last):

  File "vend.py", line 7, in <module>

    txt=variable_subsitution("Michaek","Michael")

  File "vend.py", line 2, in variable_subsitution

    for x, y in dic.items():

AttributeError: 'str' object has no attribute 'items' 

Please log in or register to answer this question.

Browse Categories

...