"...an error, something about the 'end'" is not much to go on.
Most of the time, when there is an error in a python program,
Python will print "traceback" error message. When asking for
help please copy and paste those lines in your post. Without
that it is just a guessing game for anyone to try and figure
out what is wrong.
Did perhaps your traceback message look like this?
File "xx3.py", line 28
print ("digits matched: ", end='')
^
If so, you are running your program with python2, not python3.
So you need to either figure out how to run python3 (does entering
the command "python3" do anything?) or change the program to work
with python2.
If the error message was different than above, you need to post
it here if people are to have any chance of helping you figure
out what is wrong.