Blog3.webp

ChatGPT vs. Me: Can an AI Chatbot Build a Program From Scratch Better Than a Human?

06/28/2023
7 minutes

It took me, an absolute beginner programmer, just under 15 minutes to code my first program in Go completely from scratch, no AI involved. Impressed? I am! While it might not be the most sophisticated program, watching the code I typed into the terminal actually do something was (no exaggeration) extremely rewarding. 

Some context: As Codecademy’s Content Marketing Manager, I often get to talk to people in our community who launched careers in tech after learning to code. It’s easy to get inspired listening to the stories about people who’ve gone from a total beginner to a pro in a matter of months — it’s harder to actually take initiative and get started. 

I have rudimentary HTML/CSS experience (thanks, MySpace) and know a teeny bit of JavaScript, but like lots of people, I’m a busy person and I struggle to learn consistently. Making time to learn to code is tough, whether you’re at the start of your coding journey or trying to upskill in your current role. And with AI tools like ChatGPT making it easier than ever to quickly generate working code, now newbies can bypass the tedious parts of writing code syntax. 

Learn something new for free

Plenty of people who work with code are already finding ways to incorporate generative AI and ChatGPT into their workflow. In the 2023 Stack Overflow Developer Survey, 82% of respondents who are learning to code said they’re using or planning to use AI in their development process. So we wanted to see for ourselves: Can a human with beginner coding knowledge quickly build a coding concept from scratch better than the large language model ChatGPT? Here’s what happened.

Selecting a course

We recently updated our course catalog, slicing long courses into shorter bite-sized chunks. Now, you can choose from hundreds of smaller free courses, making it easy to learn a language concept quickly. For someone like me, who’s easily intimidated by how long it takes to learn how to code, but is eager to explore coding further, these courses are a Goldilocks solution. 

I decided to take the free beginner course Learn Go: Fundamentals. A learner recently told me that his favorite language is Go because it’s simple and concise, so it felt like a good option for me. Go was created by Google for in-house development, and the language is now used for everything from cybersecurity to web development. A delightful bonus: The project at the end of this course involves printing ASCII art of a gopher (Go’s mascot), which felt like a supercute way to combine my creative sensibilities with code. 

The first few modules covered the basics of how to compile and run programs in Go, then it was time to complete the first project. The Gopher It project incorporates the use of fmt to make ASCII art.

Completing the project on my own

I set a timer on my watch and began working on the project. It took me a total of 14 minutes and 48 seconds to code the gopher, in part because I’m impatient. I wanted to skip over steps to get to the fun part faster, but in the process I missed important information that I eventually had to go back to.

It helped to use the hints within the tasks to remember specific syntax. When it came time to compile the program, I typed the command into the terminal, but it didn’t work. I got an error response: main.go:3:11: expected 'STRING', found newline. I went and watched the YouTube video walkthrough of this project and noticed where I went wrong; I forgot to put “” around fmt. When I added those and my gopher appeared, I was so excited that I fist pumped the air.

Prompting ChatGPT to do the project

Feeling like a genius, now it was time to see what ChatGPT could come up with given the same instructions. The prompt that I gave ChatGPT was: “Can you please incorporate the use of fmt in the programming language Go to make ASCII art in the shape of a gopher?” Here’s what the AI chatbot delivered in just seconds:

The gopher is very minimalist and takes a lot of artistic liberties. It looks more like a heart or a pear than a gopher, even when I printed it in the terminal. Though, in ChatGPT’s defense, the chatbot’s response included this note: “The ASCII art provided above is just a simple example. You can find more elaborate and detailed gopher ASCII art online or create your own.” Writing a clear and specific prompt is part of getting a relevant response from a chatbot. (You can learn how to write prompts in our free course Intro to ChatGPT.) Maybe the prompt needs more information to get it closer to what we want? 

I changed the prompt, this time requesting, “Make the ASCII art of a gopher look more detailed, and use the programming language Go and incorporate fmt.” Here’s the code that ChatGPT generated the second time around:

package main


import "fmt"


func main() {
fmt.Println("⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⠴⠒⠒⠐⠈⠐⠂⠉⠉⠁⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⠀⠀⠀⠀⠔⠁⠀⠀⠈⢀⣀⣀⡤⠴⠶⠶⠒⠒⠚⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⠀⡠⠂⠈⡀⠀⠀⡠⠂⠀⠀⠀⠀⠈⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⡎⠁⠀⠀⠈⡇⠀⡎⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠈⡇⢸⡄⠀⠀⠀⠀⠈⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠈⡇⠈⠻⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠹⠀⠀⢿⣄⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠻⢿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢳⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⢿⣦⣄⠀⠀⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣦⠀⠀⠀")
fmt.Println("⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀")
fmt.Println("⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙")
}

And here’s what the ASCII image looks like when you run the program. The ASCII art is more detailed, certainly, but not at all gopher-like. Makes you wonder if ChatGPT knows what a gopher is and looks like?

Comparing my project and ChatGPT’s

Art is subjective, even ASCII art. When determining which ASCII gopher is “better,” there are the visual parameters to consider (does it look like a gopher?) as well as the syntax (is the code written in a way that the program will run?). While the code that ChatGPT created was syntactically correct and runs, the ASCII interpretation of the gopher is highly abstract. 

An ASCII art gopher as coded by a human (left). ChatGPT’s interpretation of an ASCII gopher (right).

I could see using ChatGPT if I needed to quickly generate syntax for something, but as a learning tool or an artistic gizmo, it leaves a lot to be desired. This project has pretty low stakes, but imagine if you were tasked to write a program with real-life implications? Relying on ChatGPT to write your code opens the door for errors that can have serious impact. Without making mistakes in my code and figuring out how to correct them, I wouldn’t have picked up important coding habits (like double-checking that I included quotation marks) that I’ll need going forward. More importantly, realizing that I actually can write code has given me the motivation to keep learning Go.

In the past few months that ChatGPT has taken off, there’s been plenty of discourse about what this technology means for the future of coding and developers. The way folks write coding syntax might change and likely become more efficient. But at its core, programming is all about issuing commands in a way a computer can understand — and that’s a skill that’s going to remain relevant as AI takes off. 

Developers today need to learn coding fundamentals and understand how and when to utilize these AI tools. (That’s one reason why we launched the free course Intro to ChatGPT, so learners like you can dive into the advanced AI chatbot.) This goofy little gopher project is proof that there’s more to coding than just copying and pasting syntax. In order to really think like a programmer, you might be better off typing your code one letter at a time. But if that still sounds intimidating or tedious, I’d encourage you to just gopher it. 

Want to check out all of our free courses? Explore the recently-overhauled catalog to discover short, free, beginner-friendly courses like this.

Related courses

7 courses

Related articles

7 articles