Question about code in chapter 1 second edition part twosolved

Hi, I fixed the problem. There was a typo. Thank you for your help.