Nicholas T. answered 04/03/22
Computer Engineering Graduate
What I have done for these kind of assignments is copy the code from VSCode editor.
The syntax highlighting from VSCode (and whatever theme you are using) is preserved when you copy and paste into Microsoft Word.
An alternate solution is to use LaTeX with the listings package.
For a very primitive solution, you can also just screenshot your editor and just paste this image into Word, obviously this is not ideal.