Python code plagiarism checker
Python is the easiest language to copy and the easiest to disguise: a rename and a reformat take a minute and leave a file that looks nothing like the original. This page shows what a checker still sees after that, what makes two honest submissions match, and how to run a whole class.
Checks every .py file against classmates, the web and AI.
words.pylab3.pyEvery identifier is different (highlighted) and a text diff shows nothing in common. The structure is the same line for line, down to returning the words in ascending order when the task asked for descending.
How to check a Python class
- One folder or file per student.
alice/,bob/, oralice.py,bob.py. Most LMS bulk downloads already come out this way. - Leave out what nobody wrote. Drop
venv/,site-packages/,__pycache__/and datasets. They slow the upload and add nothing to compare. - Add your starter code. The handout, the test harness, any function signatures you gave out. Matches against it are left out of every score.
- Upload the ZIP and read the list. Submissions come back sorted by score. Open the ones at the top to see the matching lines side by side.
What students change, and what it does
Almost every disguised Python copy uses the same handful of edits. They fall into two groups.
| The edit | Hides it from a reader? | Hides it from a structural check? |
|---|---|---|
| Rename variables and functions | Often | No |
| Reformat: spacing, blank lines, quote style | Sometimes | No |
| Add or rewrite comments and docstrings | Sometimes | No |
| Reorder functions in the file | Often | No |
| Add type hints | Rarely | No |
| Turn a loop into a comprehension, or back | Often | Partly |
| Split one function into two helpers | Often | Partly |
The first five change how the file reads and leave its structure alone, so the score barely moves. The last two do change the structure, and the score for those lines drops. A student rarely rewrites a whole file that way, though, so the rest of it still lines up. That is the reason to open the match and read it and not stop at the number.
What matches between honest students
Python is compact. A ten-line exercise has very few reasonable solutions, and a class of forty will produce the same one several times. Before treating a high score as a problem, check whether the match is made of these:
- The scaffolding. Import blocks,
if __name__ == "__main__":,argparsesetup, reading a file line by line. - Anything you handed out. Class skeletons, function signatures, test files. Uploading starter code removes these, and it is the single biggest fix for noisy results.
- Textbook algorithms. Binary search, bubble sort and recursive factorial look the same from everyone, including the textbook.
- Very short files. The shorter the submission, the less a high percentage means. Twenty matching lines out of twenty-five is weaker evidence than sixty out of three hundred.
What honest students almost never share: the same bug, the same unused variable, the same misspelled name, the same strange order of operations. Those are what to look for. There is more on this in what a code similarity score means.
Check this week's Python assignment
Upload the class as a ZIP. Starter code is left out of every score.
Where copied Python comes from
A classmate
The most common source. Every submission is compared with every other, so a copy shows up as a pair, or a cluster when one solution went around a group chat.
Last year's class
If you reuse an assignment, old solutions circulate. Checking against earlier terms catches the ones handed down.
GitHub and the web
Popular courses have their solutions posted publicly. A web match links to the page it was found on. More on GitHub matches.
An AI assistant
No source to match against, so it is flagged by how the code is written, with the reasons shown. More on AI detection.
Reading a Python match
- Start with the matched lines, not the percentage. Ask what the shared part is: the core logic, or the boilerplate around it.
- Look at who else matches. One pair at 90% in a class that otherwise sits under 30% stands out. Fifteen students at 80% usually means the task has one obvious answer.
- Check both directions. A short file copied into a long one gives a high score for the short file and a low one for the long file.
- Ask the student to change it. Someone who wrote
top_wordscan make it return the bottom five in a minute. That conversation settles most cases.
For the full process, see how to detect code plagiarism. If you are writing the rules for your course, there is a collaboration policy template you can adapt.
Frequently asked questions
How do I check Python code for plagiarism?
Collect the submissions as one folder or .py file per student, zip them and upload the ZIP. Each submission is compared with every other one, with code already on the web, and checked for AI-written code. The results list the highest scores first and each one opens the matching lines side by side.
Does renaming variables get past the checker?
No. Submissions are compared by structure, so new variable and function names, different spacing, added comments and reordered functions do not hide a copy.
Why do two honest Python submissions match?
Short programs with one obvious solution look alike, and so does anything every student was given: the imports, the main guard, argument parsing, a class skeleton from the handout. Upload your starter code with the assignment so those matches are left out, then read the lines before deciding anything.
Can it tell if Python code was written by ChatGPT or Copilot?
It flags code that is likely AI-written and lists the reasons. Treat that as a reason to ask the student to walk you through the code, not as proof.
Should I include virtual environments or __pycache__?
No. Upload the code the student wrote. Leave out venv folders, site-packages, __pycache__ and data files, which add size and nothing worth comparing.
Does it work for multi-file Python projects?
Yes. Keep each student's project in its own folder inside the ZIP. A copied module still matches when it has been renamed or moved to a different file.
See what is in your class's Python
Every submission against classmates, past terms, the web and AI, with the lines side by side.
Get started Every plan includes Deep Scans.