Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: read section

  • Create an iterator that given the name of a file like the following, will return once section at a time.
  • It will return a list one each iteration and each element of the list will be a line from the current section.
  • Other ideas what should be returned on each iteration?
name     = Mercury
distance = 0.4
mass     = 0.055


name     = Venus
distance = 0.7
mass     = 0.815


name     = Earth
distance = 1
mass     = 1

name     = Mars
distance = 1.5
mass     = 0.107