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 or register to answer this question.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.5k answers

500 comments

108k users

Browse Categories

...