Hi guys.
Welcome to this session.
So in this session we'll see how we can make use of ChatGPT for debugging any type of code as well.
So let's give it a specific scenario.
So what we are going to do is possibly ask it to first generate a code.
And then we'll modify it, mess it up a little bit, and then give it as our code to the tool to check
whether it is able to spot the error or not.
So we're giving it a specify asking it to create a Python code.
To generate the let's say Fibonacci series, Funaki series, as you know, is a series of numbers,
which is basically the next number is a sum of the previous two numbers.
So I'm asking it to generate a Python code to generate the Fibonacci series.
So as you can see, it has gone ahead and created the code over here.
So we can go ahead and take this.
So we have the answer over here.
And now we can go ahead and modify it.
So we're going to paste it over here.
And let's say we are going to modify this.
I will say that here is my code.
Not.
Giving the right output.
What is wrong with it?
So now we are giving it as a question asking it that this is a specific code I have written.
There is a mistake in the calculation of the next term in your code.
You're adding this, which is exactly what we had pointed out.
Okay.
It should have been one.
We have changed that to two over here.
Okay.
So replace this with one.
It's giving a clear example of how to do it.
And now it has also given us the corrected code as well which we can apply.
So this is how you can give it any code which you're writing, which you have written or which was already
there with you, which you want to, which is not running specifically on any platform.
And it can correct it, tell you the line item where the error is, and give you the solution of it
as well, which you can replace in the code and make it work.