CapWords

Report a typo

In Python, the names of classes (you'll learn about them in detail later) follow the CapWords convention. Let's convert the input phrase accordingly by capitalizing all words and spelling them without underscores in-between.

The input format:

A word or phrase, with words separated by underscores, like function and variable names in Python.

You might want to change the case of letters since they are not necessarily lowercased.

The output format:

The name written in the CapWords fashion.

Make use of word.capitalize() to switch the first letter of a word to uppercase and the rest of the letters to lowercase.

Sample Input 1:

BIRD

Sample Output 1:

Bird

Sample Input 2:

my_class

Sample Output 2:

MyClass
Write a program in Python 3





___

Create a free account to access the full topic