ChatGPT can be a patient tutor that is available at two in the morning. It can also quietly do your homework for you, which helps nobody when the exam arrives. The difference is how you use it and whether your course allows it. This guide is for students whose course permits some AI help and who want to use it in a way that stays honest and actually builds their skills. If you have not checked your policy yet, start with is using ChatGPT for coding homework cheating?, because everything below assumes the answer for your course is "some use is allowed". Policy details below come from official pages we read in October 2026.
Step 1: Find out exactly what is allowed
Read the AI section of your syllabus, the course website and any assignment-specific instructions. A study of 98 computing syllabi from 54 US research universities found that most of them prohibited or restricted generative AI, and that the rules varied widely between courses, so do not rely on what another class does. Write down three things: which tools are allowed, which uses are allowed (concepts, debugging, code generation, tests), and how you are expected to disclose.
Some courses allow only their own assistant. Harvard's CS50x honesty page lists CS50's own AI software, including the CS50 Duck, as reasonable and other AI software that suggests or completes answers or code as not reasonable. In a course like that, the honest version of this guide is simply: use the Duck, not ChatGPT. If the syllabus says nothing, ask. At Stanford, the default guidance for a course with no explicit policy treats AI help like help from another person and rules out using it to substantially complete an assignment.
Step 2: Attempt the problem first
Before you open a chat, read the task, sketch a plan and write whatever code you can, even if it does not run. Commit or save that attempt. This does two things. It means you are asking about a specific gap rather than asking for a solution, and it gives you a record of your own work if anyone ever asks. Twenty honest minutes of being stuck is often where the learning happens.
Step 3: Ask for understanding, not answers
The way you phrase a request decides whether you get a lesson or a solution. Requests that usually stay on the learning side, where your policy allows AI help:
- "Explain what a segmentation fault usually means in C, with a small example unrelated to my assignment."
- "I think my loop runs one time too many. Ask me questions that help me find why, but do not give me the fix."
- "What is the difference between a list and a tuple in Python, and when would I choose each?"
- "Here is my plan in pseudocode. What edge cases might I be missing?"
- "Give me three practice problems like this one so I can practise the idea."
Requests that usually cross the line, unless your course explicitly allows code generation:
- Pasting the full assignment prompt and asking for a solution.
- Asking it to "fix my code" and submitting the corrected version it returns.
- Asking it to write the functions, tests or comments that the assignment asks you to write.
Step 4: Type it yourself, in your own way
If the model shows you an example to explain an idea, close it and write your version from understanding, not by copying. If you cannot do that, you have not understood it yet, so ask a follow-up question rather than pasting. This is not about disguising anything. It is the difference between learning a technique and transcribing one, and it is the same rule good students have always used with textbook examples.
Step 5: Keep a short log
Keep a plain text file or a section in your notes with the date, what you asked and what you did with the answer. A log in your own words is easy for an instructor to read. A few lines per session is enough:
- "Oct 3: asked ChatGPT why my recursive function never returned. It explained base cases. I added my own base case and tests."
- "Oct 4: asked for edge cases in my plan. Added empty-input handling myself."
Step 6: Disclose the way your course asks
If your course has a disclosure format, use it exactly. If it requires disclosure but gives no format, a short note in your README or at the top of your main file is clear and honest:
- Which tool you used.
- What you used it for, such as explaining concepts or reviewing your plan.
- What you did yourself, such as all of the code and tests.
When you are unsure whether something needs disclosing, disclose it. Over-disclosing costs you a sentence; under-disclosing can cost you a grade.
Step 7: The explain-it test before you submit
Before you submit, explain your solution out loud in two minutes, as if to a teaching assistant. Then imagine a small change to the requirements and say how you would handle it. If there is any part you cannot explain or change, go back and learn it. Instructors often ask exactly these questions, and passing this test means the work is genuinely yours. For more on keeping a record of your process, see how to prove you wrote your own code.
A habit worth building
The students who get the most from AI help treat it like office hours: they arrive with an attempt and a specific question, and they leave with understanding, not a file. That habit stays useful long after this course, because the same skills of breaking down a problem and asking a precise question are what make someone good at programming with or without tools.
Checking your work
You can paste your finished code into the detector at the top of this page to see which parts read like generated code and why. Use the reasons as a self-check: if it points to a section you do not fully understand, spend time on that section before you submit.
Read more
- Is AI-generated code plagiarism? — how integrity policies treat AI-written code.
- Can professors tell if you used ChatGPT for code? — the checks courses use.
Frequently asked questions
Can I use ChatGPT at all if my course bans AI?
No. If your course bans outside AI tools, none of the techniques on this page make it allowed. Some courses offer their own approved assistant instead; CS50x, for example, allows its CS50 Duck while ruling out other AI software that suggests or completes answers or code. Use what your course provides, and ask your instructor if you are unsure.
What is the safest way to use ChatGPT when it is allowed?
Write your own attempt first, then ask for explanations, hints or a review of your thinking rather than finished code. Keep a short log of what you asked, and disclose your use the way your course asks. That keeps the work, and the learning, yours.
Should I paste the assignment instructions into ChatGPT?
Usually not. Pasting the full prompt invites the model to solve the whole task for you, which most policies do not allow. Ask about the specific concept or error you are stuck on instead, in your own words.
How do I disclose that I used ChatGPT?
Follow your course's format if it has one. If it does not, a short note in your README or at the top of the file works: which tool, what you used it for, and what you did yourself. When in doubt, disclose; Stanford's guidance, for example, tells students to default to disclosing.
Is it okay to use ChatGPT to check my finished code?
If your policy allows AI review, asking it to point out bugs or unclear parts after you finish can be a good way to learn. Fix the problems yourself rather than pasting back a rewritten version, and mention the review in your disclosure.
Try the detector
Have a snippet you are unsure about? Paste it into the free AI Code Detector to get a verdict, an AI probability and the reasons behind it. No sign-up, and your code is not stored.