Since this is a comp science / math assigment, I'd give the student a C for the comp sci part and an F for the math part.
The C because he merely copied the code and did not improve it or demonstrate that he tested this code.
The F because I doubt your student understand the math being preformed.
Average grade would be an D.