ChatGPT and programming

29

October

2023

5/5 (1)

I have heard from friends about the capabilities that ChatGPT has for helping programmers write code. Therefore, in this blogpost, I will test ChatGPT’s coding knowledge and accuracy. To do this, I will ask ChatGPT to create some simple programs from scratch, and test if the code that ChatGPT generates actually works. Usually, one of the first things that you learn when programming is how to program a calculator. Therefore, I will ask ChatGPT to program a calculator in Python as this is a common language and I am planning on learning it during the course of my BIM studies.

The inputs is as follows: Program a calculator in Java and Program a calculator in python.

This is the result:

When I run  the python script it gives me the following result:

As you can see, the calculator works, and I decided to also test the dividing by zero function just to be sure. I find it interesting that ChatGPT is capable of creating this code in a couple of seconds, and also does not forget to include that division by 0 is impossible. Now that we know that this works, we can try to test further and see what the limits are of how much ChatGPT can do without me having to write a single line of code.

Therefore, to improve the calculator, I asked ChatGPT to add buttons so that we do not have to type the operation we have to perform. This was ChatGPT’s output:

When testing the code, we get a working calculator which has buttons.

I find this quite impressive already. Therefore, I want to see now what would happen if I ask it that the inputted numbers should be able to be clicked on in the screen.

As you can see, ChatGPT just created a fully working basic calculator, and it did so in 3 prompts. I opened another ChatGPT window and made one specific prompt which was: Create a calculator with buttons for input and operations in python. This yielded the same result, showing that if you are specific, ChatGPT can be a very powerful tool to help you with programming. All in all, I am impressed that ChatGPT knows how to create a GUI and working calculator with little input.

Please rate this

How good are ChatGPT’s jokes?

22

October

2023

No ratings yet.

When asking ChatGPT to tell you a joke, its first few responses are relatively simple jokes and puns.

One example is: Why don’t scientists trust atoms? Because they make up everything!

And the second prompt yielded: Why did the scarecrow win an award? Because he was outstanding in his field!

While these jokes are not too bad, just very standard, they do not shine in terms of creativity. Therefore, I tried to push ChatGPT into less comfortable zones to see if it was capable of producing humor. First, I asked it to make a joke which was more than two sentences.

This yielded the following result:

This is still humor that is copied from jokebook, as a quick google search shows that until now all these jokes are not original. Therefore, I changed the prompt to create an original joke with 3 to 5 sentences, which yielded the following result:

Although the whole joke might not be funny, there are some good puns included, with my personal favorite being creating byte-sized pastries. However, personally I felt that ChatGPT just tried adding a lot of puns to each other in a decent attempt at creating humor. I think it was at least partially successful, as a quick google search shows that the joke is original, so it is genuinely AI generated and I cannot find any references online. However, I am still curious if ChatGPT is able to tell a funny story without the usage of puns. Therefore, the next prompt I used was: create an original joke of more than 3 sentences without puns. This yielded the following result:

The story was definitely longer, however it lacks any humor whatsoever. The story is about teaching a valuable lesson and there is nothing remotely funny about the story ChatGPT created. However, I decided to give ChatGPT the benefit of the doubt to see if a regenerated response would be better. This was the result:

I find this to be an overall better attempt, as there is a buildup for the joke and even a punchline at the end. Personally, I did not find it that funny but it does show that AI is able to create jokes successfully to limited extent. All in all, I am impressed with how far AI has come when trying to simulate humor.

Please rate this