One of the most novel and interesting abilities of an AI is programming. The AI itself is, after all, nothing more than code. This does logically lead to the conclusion that AI can create AI, ad infinitum. We’ll explore that another time. For now, let’s make a calculator app (or let ChatGPT code it, as the case definitely is).
I let ChatGPT code an app
I’ll be honest with you here. I’ve never made an app before in my life. This article, and the proceeding series of articles, which follow my journey of creating progressively more complicated apps, will serve as a publicly humiliating record of starting from ground zero.
Essential AI Tools
Content Guardian – AI Content Checker – One-click, Eight Checks
Originality AI detector
Jasper AI
WordAI
Copy.ai
With that said, I don’t need to know how. You don’t need to know how either. Even if you know nothing about mobile app development, writing code, and you can barely follow instructions, you too can make an app. It’s basically the new ‘podcast’. Follow along, and let’s make our first apps together, using AI. Try “What is ChatGPT – and what is it used for?” or “How to use ChatGPT on mobile” for further reading on ChatGPT.
Thankfully for us, ChatGPT knows how to read and write Python code. Actually, it knows a lot of programming languages; Java, Javascript, HTML, PHP, CSS, SQL, Ruby and more. However, a lot of the AI industry is built on Python – including ChatGPT itself. Let’s start there.
How to use ChatGPT to code a calculator app
My first prompt in this process was very straightforward.
“Code a calculator app in Python”
I don’t know what I was expecting… but it did it.
The app itself is not complex by a professional engineers standards. The more complex you go, the more likely bugs are to creep in, but that goes for humans too. All I need was a quickly verifiable-as-functional piece of software to prove my point. That, with nothing more than a 6-word user input, Chat GPT was able to circumvent my lack of data science education entirely.
In addition to doing what I had asked of it, it then told me what to do next. Following the code itself, delineated by a visually distinct box, the addendum reads “Copy and paste this code into a Python interpreter or a .py file and run it. It will display a simple command-line interface for the calculator app where you can perform basic arithmetic operations. To exit the calculator, just type ‘q’ when prompted for the operator.”
It told me what I didn’t know I didn’t know. That, is the truly astounding difference between an AI chatbot and traditional search. Off I went to find this “Python interpreter”. I will admit, for this task, I used Google.
Having found an online compiler that required no downloading, I copy & pasted in ‘my’ first ever code. I hit the “Run” button. It ran.
This simple sum, “5*3=15”, is currently my magnum opus as a computer programmer. Having skipped print “Hello world” and ascended immediately to genius level, I retired there and went back to programming words instead.
Conclusion
My AI chatbot here is merely GPT-3.5. Upgrading to ChatGPT Plus, I would access to GPT-4 and the host of improvements that comes with. Any modern LLM (Large Language Model) is capable of similar magic, and though they may differ in how they write the same piece of code,the capabilities are largely the same. Each of our favourite natural language processing platforms is also a programming powerhouse, and this use case should be incredibly exciting to anyone who has access to it – and that person is you.