") quote, single
(') quote or three double (""") or
three single (''') quotesStrings are a Sequence
stringExample1[1] = e
len() functionlen(stringExample1) = 13
len(‘Hello World’) = 11
in keyword
not and in keywords
(not in)“4061CEM” in stringExample1 = True
“4063” in stringExample1 = False
“4063” not in stringExample1 = True
Uppercase
upper() method
stringExample1.upper() = HELLO 4061CEM
“hello 4061cem”.upper() = HELLO 4061CEM
lower() method
stringExample1.lower() = hello 4061cem
“hElLo 4061CeM”.lower() = hello 4061cem
strip() method
stringExample1.strip() = Hello 4061CEM
” Hello 4061CEM “.strip() = hello 4061cem
replace() keyword
stringExample1.replace(“4061”, “4059”) = Hello 4059CEM
“Hello 4061CEM”.replace(“4061”, “4063”) = Hello 4063CEM
+ operatorWelcome to 4061CEM print(“Welcome to” + stringExample1 + stringExample2) = Welcome to 4061CEM
+ operatorformat()
method
{}”)“{}{}”.format(intExample1, stringExample1) = 4061CEM
"{}{}: {}".format(intExample1, stringExample2, stringExample1)
"{0}{2}: {1}".format(intExample1, stringExample2, stringExample1)“{}{}: {}”.format(intExample1, stringExample2, stringExample1) =
4061Programming and Algorithms 1: CEM
“{0}{2}: {1}”.format(intExample1, stringExample2, stringExample1) =
4061CEM: Programming and Algorithms 1
f character at the beginning
of a string declaration{})f”Hello {name} it is nice to meet you!” =
Hello Ian Cornelius it is nice to meet you!
f”Hello {name} it is nice to meet you! Your age is: {age}.” =
Hello Ian Cornelius it is nice to meet you! Your age is: 33.
") will not allow another double quote inside
it\)