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
[[email protected]]# 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.
[[email protected] python]# python string_manip.py
Latest posts by Rick Donato (see all)
- How to Configure a BIND Server on Ubuntu - March 15, 2018
- What is a BGP Confederation? - March 6, 2018
- Cisco – What is BGP ORF (Outbound Route Filtering)? - March 5, 2018
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