Exercises: File permissions

Exercise 1:

Exercise 2:

The data folder contains 200 files. Each file is named according to a type of measurement (A or B), and a location (1-100) e.g. A_21, B_56 etc.

The scripts folder contains a python script which takes the names of an A and a B file as arguments e.g. scripts/calculate_score.py data/A_1 data/B_1

This will calculate a score based on the data in the two files and print it to standard output along with the name of the files used.

  1. Make calculate_score.py executable

  2. Use a for loop to run through the data files corresponding to each location and generate a score

  3. Modify the for loop to save the scores to a file

  4. Use the sort command to find the location with the highest score

Next activity: Exercises - Shell scripts.