Chatgpt Developer Cheatsheet
Chatgpt Developer Cheatsheet
io/blog/chatgpt-cheat-sheet-for-developer
Login
1 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
3 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
5 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
6 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
7 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
10 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
def sum_list(nums):
import [Link].*;
11 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
import [Link].*;
import [Link].*;
public class evenodd {
public static void main(String[] ar
gs) throws InterruptedException {
Scanner sc = new Scanner(Syste
[Link]);
[Link]("Enter the low
er range: ");
int lower = [Link]();
[Link]("Enter the upp
er range: ");
int upper = [Link]();
[Link]();
[Link]();
[Link]();
12 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
[Link]();
[Link]();
[Link]("Sum of even
numbers: " + evenSum);
[Link]("Sum of odd
numbers: " + oddSum);
}
}
13 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
function calculateSum(nums) {
let sum = 0;
for (let i = 1; i < [Link]; i++)
{
if (nums[i] % 2 == 0) {
sum += nums[i];
}
else {
sum -= nums[i];
}
}
return sum;
}
14 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
def find_max(lst):
max_value = lst[0]
for i in range(1, len(lst)):
if lst[i] > max_value:
max_value = lst[i]
return max_value
15 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
ber;
[Link] = balance;
}
public BankTransaction(BankAccount
account1, BankAccount account2) {
this.account1 = account1;
this.account2 = account2;
}
Account(123, 1000.0);
BankAccount account2 = new Bank
Account(456, 2000.0);
BankTransaction transaction1 =
new BankTransaction(account1, account
2);
BankTransaction transaction2 =
new BankTransaction(account2, account
1);
[Link]();
[Link]();
}
}
18 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM users WHERE use
rname = '$username' AND password = '$pa
ssword'";
$result = mysqli_query($conn, $query);
19 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
20 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
21 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
22 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
23 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
24 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
def calculate_mean(numbers):
total = sum(numbers)
mean = total / len(numbers)
return mean
def calculate_median(numbers):
[Link]()
25 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
[Link]()
if len(numbers) % 2 == 0:
mid = len(numbers) / 2
median = (numbers[mid - 1] + nu
mbers[mid]) / 2
else:
mid = len(numbers) // 2
median = numbers[mid]
return median
numbers = [1, 2, 3, 4, 5]
mean = calculate_mean(numbers)
median = calculate_median(numbers)
print(f"Mean: {mean}")
print(f"Median: {median}")
26 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
public MyDatabase() {
data = new ArrayList<String>();
}
27 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
28 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
public MyDatabase() {
data = new ArrayList<String>();
}
29 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
def calculate_mean(numbers):
total = sum(numbers)
mean = total / len(numbers)
return mean
def calculate_median(numbers):
[Link]()
if len(numbers) % 2 == 0:
mid = len(numbers) / 2
median = (numbers[mid - 1] + nu
mbers[mid]) / 2
else:
mid = len(numbers) // 2
median = numbers[mid]
return median
numbers = [1, 2, 3, 4, 5]
mean = calculate_mean(numbers)
median = calculate_median(numbers)
assert mean == 3
assert median == 3
30 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
31 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
32 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
33 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
def calculate_grade(score):
if score >= 90:
grade = "A"
elif score >= 80:
grade = "B"
elif score >= 70:
grade = "C"
elif score >= 60:
grade = "D"
else:
grade = "F"
34 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
return grade
function sum(n) {
let result = 0;
for (let i = 1; i <= n; i++) {
result += i;
}
return result;
}
[Link](sum(1000000));
35 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
#include <iostream>
#include <fstream>
int main() {
std::string filename = "[Link]";
36 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
if (file) {
std::cout << "File opened successfu
lly." << std::endl;
} else {
std::cout << "Failed to open file."
<< std::endl;
}
[Link]();
return 0;
}
37 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
try:
num_list = [float(num) for num in n
um_list]
except ValueError:
print("Error: Invalid input")
exit()
if not num_list:
print("Error: No numbers provided")
exit()
38 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
39 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
40 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
41 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
42 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
43 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
import psycopg2
conn = [Link](
host="localhost",
database="mydatabase",
user="myusername",
password="mypassword"
)
cur = [Link]()
[Link]("SELECT * FROM mytable")
rows = [Link]()
[Link]()
44 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
try:
num_list = [float(num) for num in n
um_list]
except ValueError:
print("Error: Invalid input")
exit()
if not num_list:
45 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
47 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
48 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
49 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
50 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
51 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
Explore More
search...
52 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
First name
Email address
Subscribe
In this article
53 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
GitHub
ChatGPTCopilot
Promptsvs
forAmazon CodeWhisperer | Who's
Code Generation
Best in 2024?
ChatGPT Prompts for Code Completion
54 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
Programming
DevOps
Data Science
Design
Articles About us
Roadmaps We Feedback
Privacy Policy
Cookie Policy
Disclosure Policy
Disclaimer
Refund Policy
Follow us
Disclosure: This page may contain affliate links, meaning when you
55 of 56 11/24/24, 19:53
ChatGPT Cheat Sheet for Developers | 40 Best Prompts [Link]
56 of 56 11/24/24, 19:53