Let’s create a variable or two and manipulate the strings with Pythons built in functions.

#Importing the string module
import string
tutorial = 'a crash course in python'
#capitalize the string
#UPPERCASE the entire string
import string
#Concatenate a string
print tutorial = tutorial + ' for beginners'
#contactonate and redeclare the variable
tutorial = tutorial + ' for beginners'
#strip the new concatonation
tutorial.replace(" for beginners","")

For more fun with strings in Python look at the string class.

Categorized in:

Tagged in:

, ,