A Smarter Way to Learn Python / Chapter 71 Exercises

  • Index of exercises
  • Email me

1

2

3

4

5

6

7

8

9

10

11

12

 

Congratulations. You've aced all the exercises for this chapter.


To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to Trinket.


Post a review on Amazon for the paperback or the Kindle edition.


Email me to give me a compliment, complaint, or correction. I'll respond.


  All of my books include free interactive online exercises that make the knowledge stick.

A Smarter Way to Learn JavaScript
Shop for it at Amazon
A Smarter Way to Learn HTML and CSS
Shop for it at Amazon
A Smarter Way to Learn jQuery
Shop for it at Amazon

copyright © 2017 by Mark Myers. All rights reserved.

0,1,2,3,4,5,6,7,8,9,10,11

0

0

0

0


Open a CSV file for writing. Make everything up. with open("pets.csv", "w", newline="") as csv_file:^ *with open\(•.+\.csv•, •w•, newline=••\) as [a-zA-Z_][a-zA-Z0-9_]*: *$
Fill in the blank. with open("pets.csv", "w", newline="") as csv_file:
  data_handler = csv.writer(____ delimiter=",")
csv_file,^ *csv_file, *$
Fill in the blank. with open("pets.csv", "w", newline="") as csv_file:
  data_handler = csv.writer(csv_file, delimiter=_____
",") "`,`"`)
Fill in the blank. with open("pets.csv", "w", newline="") as csv_file:
  data_handler = csv.writer(csv_file, ____________
delimiter=",")delimiter=",")
Fill in the blank. with open("pets.csv", "w", newline="") as f:
  writer_object = csv.writer(__________________
f, delimiter=",") ^ *f, delimiter=•,•\) *$
Fill in the blank. with open("pets.csv", "w", newline="") as f:
  writer_object = _____________(f, delimiter=",")
csv.writer ^ *csv\.writer *$
Fill in the blank. with open("pets.csv", "w", newline="") as f:
  writer_object = _______________________
csv.writer(f, delimiter=",") ^ *csv\.writer\(f, delimiter=•,•\) *$
Code the next line. Make up the name of the data-handling object. Start by indenting. with open("pets.csv", "w", newline="") as csv_file:   whatever = csv.writer(csv_file, delimiter=",") ^ * [a-zA-Z_][a-zA-Z0-9_]* = csv\.writer\(csv_file, delimiter=•,•\) *$
Code the next line. The name of the data-handling object is xyz. Start by indenting. with open("pets.csv", "w", newline="") as csv_file:   xyz = csv.writer(csv_file, delimiter=",") ^ * xyz = csv\.writer\(csv_file, delimiter=•,•\) *$
Open a CSV file for writing. Then code the next line. Make everything up. with open("test-questions.csv", "w", newline="") as f:
  handler = csv.writer(f, delimiter=",")
^ *with open\(•.+\.csv•, •w•, newline=••\) as ([a-zA-Z_][a-zA-Z0-9_]*):\n [a-zA-Z_][a-zA-Z0-9_]* = csv\.writer\(\1, delimiter=•,•\) *$
  1. You now have several CSV files on the Desktop. Read one of them.
  2. Display its contents.