By Hemanta Sundaray on 2021-08-29
Convert the entire string into uppercase:
forecast = "linear regression"
print(forecast.upper())
# LINEAR REGRESSION
Convert the entire string into lowercase:
forecast = "LINEAR REGRESSION"
print(forecast.lower())
# linear regression
Capitalize the first letter of each word:
comment = "bad programming is easy."
print(comment.title())
# Bad Programming Is Easy.
Capitalize the first letter of each sentence:
comment = "bad programming is easy."
print(comment.capitalize())
# Bad programming is easy.