Python Program to Convert String to Title Case

By | August 16, 2019

Task: Write a Python program to input a string and  Convert this String to Title Case.

The source code of Python Program to Convert String to Title Case

# Write a Python program to
# input a string and change into
# Title Case string
# The user will enter String
# during program execution

# display message to enter string
# and get input string
str1 = input("Enter a string to convert into Title Case:")


# use lower() method
title_string = str1.title()

# now print UPPER CASE string
print(str1, "in Title Case =", title_string)

The output of the Python program

Enter a string to convert into Title Case:hello Python WORLD
hello Python WORLD in Title Case = Hello Python World

Leave a Reply

Your email address will not be published. Required fields are marked *