Digital life | My first apps, thanks to ChatGPT

We have read it everywhere, ChatGPT can correct computer code and even create viruses. But can it teach a layman to design programs? This is what our journalist Karim Benssaish experimented with while creating his first apps. Basic, not very pretty or original, but functional in a few minutes.




For around ten years now, I have been testing the waters with experienced users to learn how to design basic apps or video games without the dozens, even hundreds of hours of training required. The conclusion that has always emerged: impossible to ignore this training.

I have no solid foundation in computer science, just some coding skills to play around in Windows 11. Which is probably more than the average bear, but won’t get me hired at Apple. Due to lack of time, I gave up.

Until I candidly asked ChatGPT. Through the Bing search engine, which uses ChatGPT 4, I gave him a simple command: “Create an application to convert between Celsius and Fahrenheit. » His answer: 22 lines of computer code and an explanation: “You can use a programming language such as Python or Java. Here is an example of Python code that performs this conversion. »

SCREENSHOT FROM CHATGPT 4

ChatGPT’s answer to the question: “Create an application to convert between Celsius and Fahrenheit”

Which doesn’t mean much to me. How do you use Python? “You can download Python from the official website Python.org”. Computer codes, he advises, can be copied and pasted into an editor like Visual Studio Code (code.visualstudio.com) to create a file with a .py extension. Like “conversion.py”, my first application.

I chose to do everything in Windows, 70% of the market last July according to Statista, but all this can be done on macOS or Linux.

In Windows 11, simply go to the command prompt, from the folder where the script is located, and type “python converter .py”. And here is the result of my first app. I won’t make a fortune, but it works.

SCREENSHOT TAKEN FROM AN APP WRITTEN BY CHATGPT 4

The application resulting from the lines of code written by ChatGPT

Graphic discoveries

We can surely make it prettier. Let’s ask ChatGPT the same thing, a Python script, but with a “graphical interface”. The 46 line code is already more complex. When I run it, I get an error telling me that “tkinter” is not found. Back to ChatGPT: what to do? “Type the following command: pip install tk”. This message will come up often, it allows you to install different Python modules with the “pip install” command. We take note.

And we get this app, pompously called “Nice Converter”, with a field for entering the temperature, two buttons for choosing Celsius or Fahrenheit and a button for Convert.

SCREENSHOT TAKEN FROM AN APP WRITTEN BY CHATGPT 4

The second version of the application resulting from the lines of code written by ChatGPT

Here, in a short video of 1 minute 29 seconds, is the entire process for this “nice converter”.





The basis is there. With Python and Visual Code Studio installed, I ordered the same thing from ChatGPT: “Create a Python script with GUI…” with small variations, to create applications in less than five minutes. I obtained in quick succession an arithmetic test and a quiz on Quebec, five questions concocted by ChatGPT with four answer choices each. If the math test, which was supposed to be at “secondary level 3”, seemed a little stupid to me, the questionnaire on Quebec was sometimes surprising. What is the name of the traditional Quebec song often played at weddings? When is the next referendum on sovereignty scheduled?

The bastringue and “no date planned” are the answers, ChatGPT tells us.

And we also add a tool to obtain the average distance between the planets of the solar system, and a little fun allowing us to determine the distances between seven Quebec cities that we choose from a drop-down menu. None of this is revolutionary and won’t generate millions of downloads, but it’s a nice start.

It is possible to create a standalone version of these apps, which anyone can open without having to install Python and its modules. Just ask ChatGPT: you basically have to install the “pyinstaller” module with the good old “pip install pyinstaller” command. We can then create an executable file for any Windows user.

Some apps created in bursts

  • Application to calculate the distance between the planets of the solar system

    SCREENSHOT TAKEN FROM AN APP WRITTEN BY CHATGPT 4

    Application to calculate the distance between the planets of the solar system

  • Application allowing you to calculate the distance between Quebec cities

    SCREENSHOT TAKEN FROM AN APP WRITTEN BY CHATGPT 4

    Application allowing you to calculate the distance between Quebec cities

  • A quiz about Quebec

    SCREENSHOT TAKEN FROM AN APP WRITTEN BY CHATGPT 4

    A quiz about Quebec

  • “Secondary level 3” mathematics exam

    SCREENSHOT TAKEN FROM AN APP WRITTEN BY CHATGPT 4

    “Secondary level 3” mathematics exam

1/4

Of course, ChatGPT has its limitations.

His answers are inconsistent: he refused on a few occasions to deliver a quiz on Quebec news, claiming that his knowledge stops at 2021. The code, sometimes, does not work and its details are of no use.

An attempt, for example, to create an application in which the user types the names of two Quebec cities to calculate distances, using Bing Maps on the recommendations of ChatGPT, yielded nothing. When I asked him to deliver a script for drawing a cat and a boat, he provided this very funny result.

SCREENSHOTS TAKEN FROM A SCRIPT ORDERED FROM CHATGPT 4

The result obtained when we ask ChatGPT for a script to draw a cat (left) and a boat.

A good start “to have fun”

Let’s validate all of this with Nicolas Bourré, computer science professor at CEGEP de Shawinigan, a ChatGPT user whom I interviewed last May. Use of Python is approved. “It’s the de facto language for doing small tools, top-level academic stuff. It’s very easy to learn, it’s super popular and there’s a whole community behind it. »

The professor’s main advice is to “break up” the requests. “For the Celsius to Fahrenheit converter, for example, you then ask for two fields, you tell it that you would like to save the history of the calculations, you add small functionalities piece by piece. »

On the other hand, as soon as it comes to querying databases and going beyond “the simple calculator”, to modify variables in computer code, the uninitiated will be stuck, he believes. “You’ve experienced it: when it doesn’t work, you kid. You are missing the key concepts to debug the code. But there’s enough stock with ChatGPT to have fun. »


source site-63

Latest