Uppercase for input | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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