Introduction to Python ProgrammingXYZ Homework Edition

⇩ Download ▾

3.6 Chapter summary

Highlights from this chapter include:

Table 3.5 Chapter 3 reference.
CodeDescription
ord(c)Gets an integer representing the Unicode code point of a character.
chr(i)Converts a Unicode code point (integer) into a One-character string.
'\n'Escape sequence for the newline character.
'\t'Escape sequence for the tab character.
f"{number:.02d}"Creates a string by formatting an integer to be at least two digits.
f"{number:.2f}"Creates a string by formatting a float to have two decimal places.
id(object)Gets the identity (memory location) of an object.
type(object)Gets the type (class name) of an object.
my_list = ["a", "b", "c"]Creates a list of three strings.
my_tuple = ("a", "b", "c")Creates a tuple of three strings.
my_list[0]Gets the first element ("a") of my_tuple.
my_tuple[-1]Gets the last element ("c") of my_tuple.

Adapted from Introduction to Python Programming by OpenStax (openstax.org), licensed under CC BY-NC-SA 4.0. Changes were made. License: CC-BY-NC-SA-4.0.

These eBooks are a prerelease and are not yet certified conformant with WCAG 2.1 AA or any other accessibility standard. Every page is built against an automated accessibility gate, and our target for the published editions is WCAG 2.2 Level AA. If something is unusable, please tell us.