Python Practice › String Programs › Program 89

Uppercase the second half

EasyString Programs · 89 of 106

Write a Python program to convert the second half of a string to uppercase.

Advertisement
Input
"banana"
Output
banANA

Approach

  1. Split at the midpoint.

Solution

Python
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.

More string programs

← All 106 String Programs

Leave a Comment