MCQs > IT & Programming > Python > Consider the function: def hello(): return 'Hello, world!' Which is the correct way to make a decorator that could be used to make hello() return '#Hello, world!#'?

Python MCQs

Consider the function:

def hello():

    return "Hello, world!"

Which of the following is the correct way to make a decorator that could be used to make hello() return "#Hello, world!#"?

Answer

Correct Answer: def hashes(fn): def wrapped(): return "#" + "#" return wrapped @hashes def hello(): return "Hello, world!"

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it