Failure to correctly acknowledge or attribute sources you have used can result in a charge of academic dishonesty.
Citing the sources that you have used in your research allows you to join an academic conversation and is a requirement of academic writing and scientific communication.
Citing the sources you have used, allows your readers to evaluate the depth and quality of the research you have undertaken, and to trace and validate claims and interpretations presented in your work.
This depends on the style guide you are using but all styles consist of two parts: an in-text citation and a corresponding bibliographic reference arranged in a list.
Be sure to consult your course instructor on the preferred documentation style.
The reuse of code requires attribution.
MIT provides helpful guidelines on how to manage citing code but do consult with your course instructor for more specific guidance.
Add as many details as required to help your reader trace the source of the code and at the very least, include the URL and the date of retrieval.
Indicate that you have modified the code, for example use the phrases: “Adapted from:” or “Based on”
For more help visit the MIT: Writing Code guide