Uppercase for input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Uppercase for input

Hello everyone! Is there a way to add upper() to the input in my code so I don’t have to add it every time before returning/printing it? How? https://code.sololearn.com/cUbFcszE1PE6/?ref=app

17th Jul 2022, 2:08 AM
Hamsdino
Hamsdino - avatar
2 Answers
+ 3
Like this? name = input().upper() def change_final(word): if word[-1] in "AEIOUY": return word + "DINO ♄!" elif word[-1] in "BCDFGHJKLMNPQRSTVWXZ": return word + word[-1] + "INOU ♄ !" print("Hello " + change_final(name))
17th Jul 2022, 3:00 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Rik Wittkopp Yes, like this! I had already tried the “name = input().upper()” but couldn’t get it to work with my code as it was. But now, it works perfectly with the other changes you made. Thank you!!
17th Jul 2022, 4:19 AM
Hamsdino
Hamsdino - avatar