python lowercase first letter code example

Example 1: how to capitalize first letter in python

# To capitalize the first letter in a word or each word in a sentence use .title()
name = tejas naik
print(name.title())    # output = Tejas Naik

Example 2: how do you change a string to only uppercase in python

original = Hello, World!

#both of these work
upper = original.upper()
upper = upper(original)

Example 3: python lowercase first letter

def decapitalize(str):
    return str[:1].lower() + str[1:]

print( decapitalize('Hello') )          # hello