October 2019
Beginner to intermediate
498 pages
14h 13m
English
In this chapter, we introduced an important Python data type called strings—sequences of characters that provide a wide range of built-in functions, string operators, and methods.
▶ String operators:
Concatenation (+)
Repetition (*)
Indexing ( [] )
Slicing ([:] )
Membership (in and not in)
▶ Length (len) built-in function
▶ String search methods:
find/rfind
index/rindex
▶ String formatting methods:
upper
lower
center
ljust
rjust
▶ Other string methods
replace
count
We also introduced Python built-in character functions:
ord
chr
str
We used the input function to ask the user to enter values as the program executes.
We distinguished between positional and keyword parameters with an example using the print
Read now
Unlock full access