s = "python"
print("Original string:")
print(s)
print("After capitalizing first letter:")
print(s.capitalize())
# 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
"hello world".title()
'Hello World'
>>> u"hello world".title()
u'Hello World'
>>> "hello world".title()
'Hello World'
>>> u"hello world".title()
u'Hello World'
my_string = "car"
my_string.upper() # Makes EVERY letter uppercase
print(my_string)
>>> "CAR"
my_string = "car"
my_string.title() # Makes ONLY FIRST letter uppercase and others lowercase
print(my_string)
>>> "Car
my_string = "programiz is Lit"
cap_string = my_string.capitalize()
print(cap_string)
x = "string"
y = x[:3] + x[3].swapcase() + x[4:]
# Use title() to capitalize the first letter of each word in a string.
name = "elon musk"
print(name.title())
# Elon Musk
my_string = "programiz is Lit"
print(my_string[0].upper() + my_string[1:])
text = "this is an example text"
print(text.title())