Python – Print Examples

Below is a small example to show some of the various way in which print can be called within Python.

quote = "A person who never made a mistake never tried anything new."

print("ORIGINAL")
print(quote)


print("\nUPPERCASE")
print(quote.upper())

print("\nLOWERCASE")
print(quote.lower())

print("\nTITLE")
print(quote.title())

print("\nREPLACE")
print(quote.replace("person", "banana"))

Output

[root@linux]# python print_example.py
ORIGINAL
A person who never made a mistake never tried anything new.

UPPERCASE
A PERSON WHO NEVER MADE A MISTAKE NEVER TRIED ANYTHING NEW.

LOWERCASE
a person who never made a mistake never tried anything new.

TITLE
A Person Who Never Made A Mistake Never Tried Anything New.

REPLACE
A banana who never made a mistake never tried anything new.
[root@Fileserver python]# python string_manip.py
Rick Donato

Want to become a programming expert?

Here is our hand-picked selection of the best courses you can find online:
Python Zero to Hero course
Python Pro Bootcamp
Bash Scripting and Shell Programming course
Automate with Shell Scripting course
The Complete Web Development Bootcamp course
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial