Source File: ex26_code.py

These are excerpts shown as snippets from a main file named ex26_code.py. They generally only make sense in the context of the exercise text, but they're shown here separated by H2 heading tags for audible readers like NV Access.

Snippet import

import ex26

Snippet step1

print("name", ex26.name)
print("height", ex26.height)

Snippet step2a

from pprint import pprint

pprint(ex26.__dict__)

Snippet step2b

print("height is", ex26.height)
print("height is also", ex26.__dict__['height'])

Snippet step3

print(f"I am currently {ex26.height} inches tall.")

ex26.__dict__['height'] = 1000
print(f"I am now {ex26.height} inches tall.")

ex26.height = 12
print(f"Oops, now I'm {ex26.__dict__['height']} inches tall.")

Snippet step4a

from pprint import pprint
print(pprint.__doc__)

Snippet step4b

help(pprint)