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))

15th Apr 2021, 10:19 AM
Simisola Osinowo
Simisola Osinowo - avatar
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
15th Apr 2021, 10:39 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
change the wrapper function def wrapper(text): func(text.upper()) You need to include the func in the wrapper when doing decorater function
15th Apr 2021, 10:38 AM
Hoh Shen Yien
Hoh Shen Yien - avatar
+ 1
Thanks
15th Apr 2021, 10:49 AM
Simisola Osinowo
Simisola Osinowo - avatar