Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Final Quiz
2. Question 1
Summary

Instruction

Okay, let's start by simply reading a CSV file!

Exercise

Read the contents of the menu.csv file, and print it line by line in the following way:

dish - weight - price
Beetroot soup - 300g - 5.90
Chicken Broth - 250g - 4.20
...

The menu.csv file has three columns: dish, weight, and price. The first line is a header row. The file uses standard CSV settings with commas as the delimiter.

Stuck? Here's a hint!

Use the following template:

with open('filename.csv') as csv_file:
  csv_reader = csv.reader(csv_file)
  for row in csv_reader:
    ...

You may also join list's elements with:

' - '.join(list)