As a student, whenever I hear “ChatGPT” and “homework” in a sentence, my mind subconsciously goes to essays. I’m sure some of you think that way too. After all, it’s a text-to-text generative AI.
Well, I’m here to tell you that that’s not the only type of assignment ChatGPT can do.
For those studying code out there who want a little shortcut, you can also use ChatGPT to do your assignments for you. In this article, I’ll be discussing everything you need to know about how to use GPT for your coding homework and how reliable it really is.
How Can ChatGPT Do Your Coding Homework?
There are two ways of using ChatGPT to do your coding homework: one free and the other one is paid. I’m going to demonstrate both of them for you so you can choose which one fits your needs better.
Using Plain ChatGPT
The super simple secret trick to getting ChatGPT to do your coding homework? Just ask. That’s it. To demonstrate, let me ask it to make me a simple hangman game using C++.
The code that came with it is too big for a screenshot but here’s a glimpse of it:
As for the output, here’s what it looks like:
Hmm, that’s odd. It’s not registering the correct letters. This can only mean that there’s a logic error somewhere in the code. If this happens to you, don’t worry. ChatGPT can fix their mistakes as well.
Now, let’s check if the new code is logically sound.
And there we go. Now, for my final modification, I want to see an actual hangman figure when I make an incorrect guess. So, back to ChatGPT we go.
And here is our final output:
It’s pretty amazing, right? But, here’s the thing: What if you need a visual component to your output? Something that can only be described with figures and illustrations.
For that, we turn to GPT-4.
Using GPT-4V(ision)
One of the coolest things about GPT-4V is its ability to accept image prompts. This can help you achieve what you need better by creating a rough illustration that GPT can follow. For example:
Instead of a code block, GPT-4V gave me a downloadable HTML file containing the code. Here’s what it looks like:
Not exactly perfect in looks, but does it work?
Yep! This trick is better if your teacher has specific design instructions but, if you’re given something that doesn’t require designs or wireframes to follow, you’re going to get by just fine with plain ChatGPT.
What Else Can ChatGPT Do?
Programming assignments don’t stop at coding. There are other types of assessment made to check your skill level. And yes, ChatGPT can do them all too:
Debugging
Debugging can be a time-consuming process, but ChatGPT can help identify common errors in your code. Describe the issue you’re facing (or simply just copy and paste the code into the chatbot) and ChatGPT can suggest potential solutions, helping you debug your entire code.
Code Optimization
Is your code running slower than expected? ChatGPT can suggest ways to optimize your code by improving its efficiency without compromising functionality. From the simple act of cleaning up the empty spaces in your code to complete resource management, ChatGPT can easily make your code more robust.
Code Translation
Some people can’t code in Java, some can’t code in Python. It doesn’t mean they’re less of a programmer — it just means they need a little help. ChatGPT can code in any programming language, making it easy to translate code with just a single prompt.
How Good is ChatGPT at Leetcode?
Everybody who’s ever studied computer science knows and fears Leetcode. It’s basically a platform where you can train yourself in creating efficient algorithms to solve theoretical problems. Not only that, but Leetcode is also a great way to measure how accurate ChatGPT actually is at creating code.
Leetcode problems have three categories: easy, medium, and hard. For this test, I took five questions per category, pasted the problem into ChatGPT, and copied its answer into Leetcode for checking. The following are the results:
Yes, 100%. That’s scary good, especially considering that even the best programmers in the world fail one or two hard Leetcode questions.
A Few Parting Words
When you’re using ChatGPT to do your coding assignment, always remember who’s really drawing the short straw.
You.
Letting ChatGPT code for you deprives you of the knowledge and experience that comes with hands-on learning. Sure, in a company, you’ll have access to ChatGPT, Google, and other materials. But you still have to know how the individual pieces of code come together to create systems. That’s what programming is.
So, my advice is let ChatGPT code for you but try it yourself first. In other words, don’t give up before throwing the first punch. You can also ask ChatGPT to explain the code line-by-line so you can have a better understanding of what each code block does.
After you understand everything, go nuts with ChatGPT. It’s a valuable coding assistant for any skill level. But before you reach that level, try better.