# declare a function that take two entries file_name and number of lines
def read_file_lines(file_name, nlines):
# import the islice from itertools python module
from itertools import islice
#use with open statement which will open the file by its name:
with open(file_name) as f:
# then use for loop to read file line by line
for line in islice(f, nlines):
# finally print these lines that we chose inside for loop.
print(line)
# call the function that we have created to read the first three lines as the quiz ask:
read_file_lines('Python.txt',3)