Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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 to answer this question.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...