Lecture 5 — Python Strings¶
Reading¶
This material is drawn from Chapter 4 of Practical Programming, 2nd edition.
More Than Just Numbers¶
Strings are our fourth type, after integers, floats and Boolean.
We’ve already seen the use of strings in output:
print("Hello world") x = 18 y = 11 print("Value of x is", x, "value of y is", y)
Topics for Today¶
String basics
String operations
Print formatting
Strings — Definition¶
A string is a sequence of 0 or more characters delimited by single quotes or double quotes:
'Rensselaer' "Troy, NY" '41 18 154 23 402' ''