Challenge: Read CSV File

This lesson brings you a challenge to solve.

We'll cover the following

Problem statement

We are given the file products.txt with the content:

"The ABC of Go";25.5;1500
"Functional Programming with Go";56;280
"Go for It";45.9;356
"The Go Way";55;500

The first field of each line is a title, the second is a price, and the third is a quantity. Read in the data but make a struct type to gather all the data of one line and use a slice of structs to print the data. For more functionality in parsing csv-files, see the package encoding/csv.

Try to attempt the challenge below. Feel free to view the solution, after giving some shots. Good Luck!

Get hands-on with 1200+ tech skills courses.