0
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))
3 odpowiedzi
+ 4
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 .
https://code.sololearn.com/cA7A12A23A92
+ 2
change the wrapper function
def wrapper(text):
func(text.upper())
You need to include the func in the wrapper when doing decorater function
+ 1
Thanks