Exercises for Lesson 14

Back to Lesson 14

Exercise 1: Reading from a CSV file

Assume you have a file names.csv with the following format:

Lulu,12
Hobbes,12
Cheddar,0

Write a program that reads in the file and prints a message for each user:

>>> main()
Hi Lulu, you are 12 year(s) old.
Hi Hobbes, you are 12 year(s) old.
Hi Cheddar, you are 0 year(s) old.

If you have time, think about how you can tailor the message to print “year” or “years”, as appropriate.

Back to Lesson 14