Recently I got back to coding because I want to continue working on my automation platform.

I also wanted to check out AI for coding anyway.

I did some tests on ChatGPT just for fun, gave some rather easy tasks to see how it goes.

Although the tasks were not that coomplicated I am really impressed about ChatGPT.

It not only give you the pure function or so, it also gives everything else you need to run the code.

First I wanted to make a small test to see if it can create a bar chart with dummy data.

Task:

twinaxe:
1. Create jQuery ChartBar.
Example dataset:
datasets:

}]
2. Load jquery and Chart.js on pageload

Result:

<!DOCTYPE html>
<html>
<head>
<title>Chart.js Example</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
<canvas id="myChart"></canvas>

<script>
$(document).ready(function() {
var data = {
labels: ,
datasets:


}]
};

var options = {
scales: {
yAxes:




}
};

var ctx = document.getElementById("myChart").getContext("2d");
var myChart = new Chart(ctx, {
type: 'bar',
data: data,
options: options
});
});
</script>
</body>
</html>

Then I wanted to make it a little bit more difficult and I asked for a python function to fetch data from an API and the result shall be rendered to a Django template:

Task:

twinaxe:
def get_assets(requests):
1. Get json response from https://cryptingup.com/api/assets
2. Add all values ...

This thread has 2 more replies.
WANT TO SEE THE REST?

Join STM Forum