Yes, I am in control of my classes and will decide what in your work is worth points and what is not. I'll tell you that up front, with plenty of time for you to drop.
Not only will I demand you use the syntax and language I am teaching (for my own grading ease and consistency of results, like performance timing), but I will demand you follow my code formatting rules for indentation, tab stops, limits on line length, variable names and how to case them, and commenting within your code to help me see what you have done and why you are doing it.
Because the butt-sore truth is, when you get into the real world, you will find that writing working code is not enough, your code needs to be maintainable and readable by others. And chances are, you are going have to read and debug TONS of other people's code, and you will appreciate this then.
Before I was a professor I was a division manager in charge of code for a public company. Newbies are often given testing and debugging tasks to get them familiar with the code and systems and to evaluate their expertise and productivity.
So first, IRL programmers move on to other companies, departments, or roles within the company. So not only do we have to deal with code by programmers no longer with us, the senior programmers are often working on deadline for critical NEW projects, and they don't have the time to debug their own code from years ago, or even answer questions about it.
That makes maintainability of code very important, because hardware and software libraries and operating systems and compiler / interpreter release change much faster than our code base, and break our systems. The code must be legible, easy to understand, and easy to follow. I don't want any "black box" code that just "works right" because when it stops working, I don't want to rewrite it to fix it.
So I enforce that in my classes too. Yes your code has to work, but that isn't the whole grade. You must use the tools I gave you, or you don't pass: Because real companies have standards, even down to the editor you use, and my assignments are an exercise in you using the tools given, not just getting the right answer.
You must also write code that obeys my code formatting and commenting guidelines, those are worth a letter grade. Because IRL if you gave me (your manager) that as a coder, I'd have to send it back to you for proper formatting, and there goes 1 or 2 days of your pay and productivity because you can't follow simple list of written directions.
The equivalent in the classroom is your grade, so -10 for mistakenly thinking that getting the right answer is all that matters to the company. How you got the answer is important, and Maintainability of your code after you are gone or no longer maintaining it is also very important.