Let's suppose that you were assigned a programming project, which is considered from your teacher/professor, not easy. However, you manage to find an online tutorial, that guides you step-by-step through the process needed (so the source code you have written doesn't have much difference from the one on that tutorial).
The final solution is based on this tutorial, but you have also added your own information, corrected some minor errors, etc. I don't know if this matters, but you know exactly what every single line of your code does, you are able to explain and answer complex questions, etc.
Is that considered plagiarism, and if yes, why? If not, how can somebody support that on a teacher/professor?