Trying to solve uppercassing in python core | Sololearn: Learn to code for FREE!


Trying to solve uppercassing in python core

I don't know what is wrong with my code it prints none after the output You are given code that takes input and prints it as a simple row of text. Add the uppercase_decorator to make the text uppercase. text = input() def uppercase_decorator(func): def wrapper(text): print(text.upper()) return wrapper @uppercase_decorator def display_text(text): return(text) print(display_text(text))

4/15/2021 10:19:05 AM

Simisola Osinowo

3 Answers

New Answer


If you don't print(display_text(text)) just call it like that,display_text(text) it won't print None. Because, the function def wrapper(text): print(text.upper()) returns None .


change the wrapper function def wrapper(text): func(text.upper()) You need to include the func in the wrapper when doing decorater function