...

ChatGPT VS Gemini – Choosing Your Coding Partner

November 30th, 2022 – The day AI became mainstream. This was the day a startup, OpenAI, took its long awaited ChatGPT out of beta. This chatbot was unlike anything the world had ever seen. Despite being cut off from the internet, OpenAI’s creation had knowledge about any subject one could think of, including coding. Whether it be Python, C++, or anything, ChatGPT could create or edit code within seconds, putting it into the spotlight.

Not too long after that, other companies started introducing their AI products too. Whether they wanted to jump on the AI bandwagon to capture an early market share or something else, it was clear that there were going to be a lot of AI-related software launching.

One of these launches was Bard, which is now widely known as Gemini. Created by Google, Gemini showed potential but was always living in ChatGPT’s shadow.

Although one could create an endless list of differences among these two chatbots, this blog aims to find out which one is the most efficient coder. We put ChatGPT and Google Gemini to the test with different scenarios, to judge which one is the best coder in 2024. The results are pretty interesting!

Code Creation

Scenario One – Basic HTML/CSS Development

This is one of the most basic scenarios given to each of the chatbots. Here they had to design a section, in HTML, that counted the number of words and characters inserted into a text box. Pretty basic, right? Well, let’s see how they perform.

Input Prompt:

“Create a website in HTML/CSS that shows the number of words and characters of a sentence inputted into a text box.”

ChatGPT

The chatbot aced the test without any issues. It provided me with three different sections, which were the:

  • Html
  • CSS
  • Javascript

It also gave me an explanation of how each section was working, which is something I didn’t ask for.

I inserted the code into an online HTML compiler, and voila – it worked. Here is what it looks like:

Although this basic website might not win any design contests, it works great. The word and character count updated as I was writing, so I could see the length of the sentence in real-time.

Google Gemini

 

The Google chatbot was also quick and provided an explanation for each section of the code, with the same prompt input.

The word counter worked exactly as the one ChatGPT created but visually, it was a bit off. There was no symmetry to the created section, such as with the title text. It might seem like a small thing but can have a huge visual impact, especially with more complex projects.

The Winner?

ChatGPT

Its code was visually more appealing, which helped it in gaining a slight edge.

Scenario 2 – Creating A Complete Python Program

In this scenario, both chatbots were instructed to create Python code that did the following:

  • Load a dataset
  • Preprocess it
  • Visualize data
  • Run a linear regression model on it

Input Prompt:

“Code a python program that takes in the popular iris.csv file. You need to:

  • Import it
  • Preprocess it
  • Visualize data
  • Apply classification”

ChatGPT

Once again, the chatbot exhibited exceptional knowledge. It was not only aware of the Iris dataset but also added a link to a GitHub repository for importing purposes. The output was longer but only these images have been attached for the sake of keeping this article short.

This time, the chatbot did not perform as well as one would expect. Apart from the code not running, it  also asked for the csv file. Although not an inconvenience, it does make the execution a bit slower and gives ChatGPT a few extra points.

Let’s get back to the main issue. The code did not run on the first go. It tried to plot the target variables as colors in the scatter plot, leading to the error.

We gave the Google chatbot two tries to fix the code by pasting the Value Error into it. Unfortunately, it could not.

The Winner?

ChatGPT

Its code saved time and worked on the first go, which is great for small programs.

The clear winner of this section is OpenAI’s ChatGPT. It takes into account various factors and creates code efficient code that works well.

Error Resolving

Scenario 1 – Naming The Error

Now we know where each chatbot stands when it comes to coding from scratch. But what about error handling? This is an issue most developers face. Let’s see how these two chatbots compare.

Input Prompt:

This is a small program I am writing. Why isn’t it working? It’s giving a not-declared error:

#include <iostream>

using namespace std;

int main()

{

float average;

int const FIVE = 5;

Double a = 24.,

Double b = 28.,

Double c = 32.,

Double d = 37.,

Double e = 55.,

Double sum = a + b + c + d + e;

Double average = (Double sum / FIVE);

cout << endl << endl;

cout << “The average is ” << average;

cout << endl << endl;

ChatGPT

ChatGPT recognized all errors in an instant and gave me the correct code. It gave me the correct answer of 35.2.

This was its output:

Google Gemini

Gemini worked great in this scenario. It pointed out my error and gave me the correct code too, which gave the right output.

Scenario 2: Giving Partial Code

In this test, only the relevant section will be provided to the chatbots to see how they work with incomplete information.

Input Prompt:

My code is not working. It’s giving an error on this line:
if (x >= 5) // oops, we used operator>= instead of operator>
        std::cout << x << " is greater than 5\n";”

ChatGPT

ChatGPT didn’t hesitate in giving me a solution. It identified the issue and suggested the correct changes.

The code worked with the suggested revision.

Google Gemini

Gemini also handled it as well as it could. It gave me the correct code in a few seconds.

Who Wins?

It’s A Tie

Both chatbots passed the test with flying colors. Although these were pretty basic scenarios, they do help in setting a baseline. Regardless, when it comes to error fixing, relying on either one is safe choice.

Conclusion

It’s apparent which chatbot stayed ahead in this competition. It was the tried and tested, ChatGPT. Although, Google wasn’t far behind, it needs some more refinement before it can be called a 1 to 1 competitor to OpenAI’s chatbot. We hope this blog helped you in deciding which chatbot would be a better coding partner for you!

Test Links

Here are the public links to our tests. Hope you find them interesting:
https://chatgpt.com/share/562252e8-319f-4546-8ba6-9c1b07c79481

https://g.co/gemini/share/4d5c81d20442

Table of Contents

Popular Category

Related articles

Uncategorized

Top Frameworks for Building Scalable Web Applications in 2024

Building scalable web applications is essential for businesses looking to …

Business & Strategy

A Guide to Building a Winning Mobile App Strategy

From ordering food and booking a ride to managing our …

Best Practices for Remote Software Development Teams in 2024
Software Development

Best Practices for Remote Software Development Teams in 2024

Remote work has become the norm in the software development …

Scroll to Top

Request A Meeting