+ 2
How to convert a word in uppercase and lowercase in python
Given a word HelLo, Condition :- for start two characters is lower case and remains three is uppercase Output:-heLLO
2 Réponses
+ 9
You can use type str's builtin methods upper() and lower() in combination with slicing the original string and glueing it back together.
0
You can use splice and .upper() for uppercase and .lower() for lowercase characters.
So, your code can be:
word = "Hello"
print(word[:2].lower() + word[2:].upper())