Chapter 3
3.1 Strings revisited
chr() function returns a string of length one.
3.2 Formatted strings
02d appends a 0 to the front of the integer when the integer is only one digit.
3.3 Variables revisited
10
and the float object
9.7
, as shown in the memory diagram.
3.4 List basics
2 3.
len(name_list)-1, which evaluates to
3
and refers to the last element in a list of 4 elements, can also be used in place of -1 here.
3.5 Tuple basics
"a"
,
"b"
, and
"c"
.
my_tuple is initially assigned with the tuple (0.693, 0.414, 3.142). Then my_tuple is assigned with the new tuple, (0.693, 1.414, 3.142), to correct a mistake with the second element.