How does chatGPT help code?

CC(ChenChih)
Chen-Chih’s Portfolio Page
4 min readApr 5, 2023

As many people have heard about the CHATGPT in these couple of weeks or months, and indeed it’s so powerful and works in the diversity field. I would like to share how it’s able to help with writing some code. CHATGPT Is the tool that everyone MUST know how to use, it will help you be productive, and work more efficiently.

I recently found out that it’s a second search engine or even faster than it, and also it’s a second discussion forum and would like to share it.

When facing some coding problems ideally you would first use these steps:

  • Google to find any related posts often
  • got to the discussion forum and find or post it
  • ask a friend or colleague
  • other ways

The above method, which I have been using most of the time, somehow had some great advantages but dives into a weak point, which is not efficient. You need to find so many posts to find which you want, which is a waste of time.

Today CHATGPT can accelerate our time and is convenient. You just have to give them the code and ask them questions CHATGPT will help you answer them. I felt it so awesome so would like to share with you this method, indeed some developers might already know it.

But there’s one skill that you need to know, and that is asking a good question to best let AI know what you are asking. AI is so smart that 80 percent will know what you want. One more thing you don’t have to worry about grammar or spelling when you are asking, AI will know what you are asking.

Let me show you how I used it to help me find coding and I highly recommend you can use CHATGPT to help you find the code if you’re able to solve it. It will also explain the code so great. This is a fantastic tool, so I hope you can use it wisely.

Example1: Let Regular expression

I want to use a regular expression pattern to help check UL- UE[18]

Step1: ask chatgpt like this:

how to check “UL- UE[18]” using regular expression

It will give me the regular expression, but this pattern will not work if we have space or no space.

Step2: AsK GPT again like this:

“UL- UE[ 18]” I wish inside bracket can be space or without

So chatGPT gave us the pattern, the final pattern I change is: r”([UL- UE(\[\s*(\d{1,2})\])?))

So is it pretty useful, just add the code, ChatGPT will help you correct your code.

Example2 using pandas to ignore specific character

Quetion ask chatGPT:

if I have "---”how to ignore using below this code code df = pd.read_csv(file, sep=” “, names=column_names)

Ask AI to interpret your understand

So chatGPT gave me think using the comment method.

I would like to share another way how I used to achieve it. When you study a skill you can interpret your description and let ChatGPT help you check whether your understanding or interpretation is correct. This is pretty useful because sometimes you might think you understand however sometimes you might only gain some part not fully understand. So you need to ask people to validate whether you understand, AI is a good tool to validate you is really understandable.

I remember in school, students will ask the teacher if he or she interprets right for this knowledge. In writing we need to revise many times or let other people revise this is a pretty similar concept.

Whenever learning a skill you should always explain to people whether you really understand it or not but this time instead explain to people just explain to AI. I will demonstrate how I achieved it as below picture(some of them are using Google Bard, some of them are chatGPT)

Summary

As you can see the above is an easy example, you can use it in your daily work with coding. I feel like it’s much more efficient than searching on Google. But somehow you can’t always rely on it, somehow you see have to search on Google. When you search but still have no idea, just paste your code into codeGPT and ask them.

I just want to share on powerful this tool is able to speed up, especially when you want to write code. You can also ask anything other than coding questions.

Many people will be wondering if will it be a threat to Software engineering, Data Science, and so on. The answer is Yes it will be a threat to it. But it’s not a big deal, humans have the human potential on creating innovative products, and AI tools could help or support us in productive.

If you wants to use GPT4, you can use bing browser which allow you can use chatGPT 4 version, without subscriber GPT4.

--

--

CC(ChenChih)
Chen-Chih’s Portfolio Page

I self study technology, and likes to exchange knowledge with people. I try writing complex tech blog into simple and various ways for people to understand.