Python Practice › String Programs › Program 89
Uppercase the second half
Write a Python program to convert the second half of a string to uppercase.
Input
"banana"
Output
banANA
Approach
- Split at the midpoint.
Solution
text = "banana"mid = len(text) // 2print(text[:mid] + text[mid:].upper())Output
banANA
Learn the concept
New to this topic? Read the lesson, then come back.