Code doesn't work despite being from book

Printable View