Home > Articles

This chapter is from the book

Study Drills

  1. Write an English comment for each line to understand what that line does.

  2. Each time print_a_line is run, you are passing in a variable, current_line. Write out what current_line is equal to on each function call, and trace how it becomes line_count in print_a_line.

  3. Find each place a function is used, and check its def to make sure that you are giving it the right arguments.

  4. Research online what the seek function for file does. Try pydoc file, and see if you can figure it out from there. Then try pydoc file.seek to see what seek does.

  5. Research the shorthand notation +=, and rewrite the script to use += instead.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.