Instruction on
Attaching Program Code into Appendix
Aim:
You are required to attach all your programs into your report appendix. This is for Turnitin to do necessary
checking. All the code must be exactly same as the code file you will submit to the code submission portal
on Canvas. Marker may randomly check the consistency between two versions. If any inconsistency is
caught, appropriate marks will be deducted from your overall marks.
Steps:
1. It is a common practice to use a font of equal width to typeset/format your code in Appendix. If
you are using MS WORD to write your report, you may choose either Courier New or
Consolas font which are of equal width.
2. If you have py file(s), so it is easy. Simply copy and paste into your word file, but please make sure
to use a font mentioned in Step 1 to form the entire code. py files are simple plain text files, so
you can open with any plain text editor like notepad on windows. If you are using jupyder, you
can open it with jupyder (the same way as you open a notebook file). Then copy this into your
Appendix in Word.
3. If your program is in ipynb format, you have to do one of two following ways to convert them into
a py file, then follow Step 2 above. To convert an ipynb file to a py file, according to what you
are using, you follow either Step 4 or Step 5 below to do so:
4. Using jupyter (from Anaconda) in a browser:
a. Launch jupyter and open the ipynb file;
b. Select "File" in the main menu, then "Download as", then save to "Python (.py)" py file as
shown in the Figure on the next page (orders of menu items may be different).
You may need give a name with “.py” extension to save the file to a chosen location OR
the converted py file may be in the same folder as your ipynb file (depending on your
computer system).
5. Using jupyter in PyCharm IDE: At this stage, there is no graphical way as above to do so. You
need complete the job in a Terminal window of PyCharm. We use the example of converting
[Link] to [Link]
a. Click on Terminal menu at the bottom status line of PyCharm IDE
b. In the opened terminal window (at the bottom), type the following command
>jupyter nbconvert --to script '[Link]'
c. Hit the Return key then you will have the converted py file [Link] at the
same location as [Link]
Note: If reporting nbconvert is missing, use pip install nbconvert first.