Read+from+file+to+arrays

This example shows how to read from a text file into two arrays.

In the example the text file contains a film name, and a rating out of 10 on alternate lines like this:



We want to read the 1st, 3rd, 5th etc lines into an array of film names. movie_name = ['Everest', 'Legend', 'Maze Runner'] etc.

We want to read the 2nd, 4th, 6th etc lines into an array of film ratings. movie_rating = [72, 58, 50] etc.

Steps:
 * Read the file into a string
 * Work out the number of movies by dividing the lines in the file by 2
 * Loop with counter from 0 to number of movies
 * Movie name = line of file [counter * 2]
 * Movie rating = line of file [counter * 2 + 1]

Code