type stringclasses 1
value | messages listlengths 3 3 | source stringclasses 1
value |
|---|---|---|
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create an array of length 5 which contains all even numbers between 1 and 10."
},
{
"role": "assistant",
"content": "arr = [2, 4, 6, 8, 10]"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Formulate an equation to calculate the height of a triangle given the angle, side lengths and opposite side length."
},
{
"role": "assistant",
"content": "Height of triangle = opposi... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a replace method for a string class which replaces the given string with a given set of characters."
},
{
"role": "assistant",
"content": "def replace(self, replace_with):\n ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create an array of length 15 containing numbers divisible by 3 up to 45."
},
{
"role": "assistant",
"content": "arr = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45]"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function to find the number of distinct states in a given matrix."
},
{
"role": "assistant",
"content": "def find_num_distinct_states(matrix):\n states = set()\n for ro... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a nested loop to print every combination of numbers between 0-9"
},
{
"role": "assistant",
"content": "for i in range(10):\n for j in range(10):\n print(i, j)"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function to find the maximum difference between two numbers in a given array."
},
{
"role": "assistant",
"content": "def max_difference(arr):\n max_diff = 0\n for i in ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function to generate the nth Fibonacci number."
},
{
"role": "assistant",
"content": "def fib(n):\n if n == 0:\n return 0\n elif n == 1:\n return 1\n e... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a class to represent a 2D point with x and y coordinates."
},
{
"role": "assistant",
"content": "class Point:\n def __init__(self, x, y):\n self.x = x \n self.... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write code that removes spaces from a given string."
},
{
"role": "assistant",
"content": "def remove_spaces(string): \n return \"\".join(string.split())"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function that checks if a give number is even or odd."
},
{
"role": "assistant",
"content": "def is_even(n):\n if n%2 == 0:\n return True \n else:\n retu... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write code to create a list of all prime numbers between 2 and 100."
},
{
"role": "assistant",
"content": "def find_primes(n): \n prime_list = [2] \n for number in range(2, n +... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Edit the following code to print out all even numbers from 1 to 10."
},
{
"role": "assistant",
"content": "for i in range(1,11):\n if i % 2 == 0:\n print(i)"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write code to find the sum of all numbers between 1 and 10."
},
{
"role": "assistant",
"content": "sum = 0\nfor i in range(1,11):\n sum += i\nprint(sum)"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a function to calculate the area of a given circle."
},
{
"role": "assistant",
"content": "def area_circle(radius):\n return 3.14 * (radius**2)"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Follow the comments in the code to complete the program which prints a conversion table from Fahrenheit to Celsius."
},
{
"role": "assistant",
"content": "# This program prints a con... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Develop a classification algorithm in Python to predict whether a bird is a hawk or a falcon."
},
{
"role": "assistant",
"content": "import pandas as pd\nimport numpy as np\n\n# Defi... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a function in Java for computing the factorial of a positive integer number."
},
{
"role": "assistant",
"content": "public static long factorial(int n) {\n if (n == 0) {\n ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a C++ program for randomly shuffling an array of integers."
},
{
"role": "assistant",
"content": "#include <iostream>\n#include <algorithm>\n#include <random>\n\nvoid shuffleA... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Use the function to debug the given program and prevent the segmentation fault."
},
{
"role": "assistant",
"content": "#include <stdio.h>\n\nint main() {\n int array[] = {1, 2, 3,... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Replace the placeholder with a for loop for iterating over the numbers from 1 to n and printing them."
},
{
"role": "assistant",
"content": "for i in range(1, n+1):\n print(i)"
... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Use try-except statements to detect and handle exceptions in the code."
},
{
"role": "assistant",
"content": "try:\n for i in range(n):\n x = 1/i\nexcept ZeroDivisionError:... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Re-write the code segment as a list comprehension."
},
{
"role": "assistant",
"content": "numbers = [i for i in range(10) if i % 2 == 0]"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Remove the boilerplate code from the program for printing 10 random numbers."
},
{
"role": "assistant",
"content": "import random\n\n# Generate 10 random numbers\nfor i in range(10):... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Modify the code to perform the mathematical expression “x to the power of y”."
},
{
"role": "assistant",
"content": "# Calculate x to the power of y\nx_pow_y = x**y"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a dictionary for counting the occurrence of each letter in the given string."
},
{
"role": "assistant",
"content": "string = \"hello world\"\nletter_counts = {}\n\nfor letter ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Follow the comments to complete the code that finds the maximum value in an array."
},
{
"role": "assistant",
"content": "# Find the maximum value in an array\narr = [4, 5, 2, 8, 7]\... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function in HTML for creating a table of n rows and m columns."
},
{
"role": "assistant",
"content": "<table>\n <tbody>\n <% for (let i = 0; i < n; i++) { %>\n <tr>\... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a CSS script that centers the login form on the webpage."
},
{
"role": "assistant",
"content": ".login-form {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: t... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a Java program that prints out the sum of the numbers in the array."
},
{
"role": "assistant",
"content": "public class SumOfArray {\n public static void main(String[] args... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a SQL query to calculate the total number of orders in the \"orders\" table."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS \"Total Number of Orders\" \nFROM orders;... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a Python function to convert a given string to lowercase."
},
{
"role": "assistant",
"content": "def to_lowercase(string):\n return string.lower()\n\nstring = \"FOO\"\nprint... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a C program that prints out the Fibonacci sequence."
},
{
"role": "assistant",
"content": "#include <stdio.h>\n\nint main()\n{\n int i, num, first=0, second=1, next;\n p... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function in JavaScript to count the number of vowels in a given string."
},
{
"role": "assistant",
"content": "function countVowels(string) {\n let vowelCount = 0;\n co... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a JSX code that renders a \"Hello, World!\" message in the browser."
},
{
"role": "assistant",
"content": "import React from \"react\";\n\nfunction App() {\n return (\n <d... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write an SQL query to calculate the average order price for each product category in the \"orders\" table."
},
{
"role": "assistant",
"content": "SELECT category, AVG(price) as \"Ave... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a Java program that prints out the contents of a given two-dimensional array."
},
{
"role": "assistant",
"content": "public class TwoDArray {\n\n public static void main(St... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a C++ program that sorts a given array in descending order."
},
{
"role": "assistant",
"content": "#include<iostream>\nusing namespace std;\n \nint main()\n{\n int array[] ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Edit the Python code so that it prints out the total number of elements in the list."
},
{
"role": "assistant",
"content": "list = [1, 2, 3, 4, 5]\nprint(\"Total number of elements i... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a Swift code that show the number of days in the given month."
},
{
"role": "assistant",
"content": "let month = 5\nlet daysEndingInth = [3, 0, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3]\n... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a HTML code that create a form for user to fill out their current address."
},
{
"role": "assistant",
"content": "<form action=\"\">\n <label for=\"street\">Street</label>\n... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a SQL query to find the total number of orders placed between two given dates."
},
{
"role": "assistant",
"content": "SELECT COUNT(*)\nFROM orders\nWHERE order_date BETWEEN '20... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a Ruby code that prints out the median of a given array of numbers."
},
{
"role": "assistant",
"content": "nums = [1, 7, 3, 6]\nsorted_nums = nums.sort\n\n# Calculation of med... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a PHP code to check if an array contains a given item."
},
{
"role": "assistant",
"content": "<?php\n$input_array = array(1,2,3,4,5);\n$item_to_check = 3;\n\nif(in_array($item... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Edit the code to create a try-except block to handle the exception."
},
{
"role": "assistant",
"content": "try:\n a = 5\n b = 0\n\n ans = a/b\nexcept ZeroDivisionError:\n ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a script using Bash that replaces all vowels with a number."
},
{
"role": "assistant",
"content": "#!/bin/bash\n\nstring=\"Hello World!\"\nvowels=(\"a\" \"e\" \"i\" \"o\" \"u\"... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Change the variable `x` to the data type desired."
},
{
"role": "assistant",
"content": "x = \"Hello World!\""
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a function that takes an array as an argument and returns the sum of all the elements in the array."
},
{
"role": "assistant",
"content": "def arraySum(arr):\n total = 0\n ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Sort the array in ascending order."
},
{
"role": "assistant",
"content": "arr.sort() # [1, 2, 3, 4, 5]"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Generate a random integer between 4 and 8 (inclusively)."
},
{
"role": "assistant",
"content": "import random\nx = random.randint(4, 8)"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a list comprehension to square each number in the list."
},
{
"role": "assistant",
"content": "arr = [x**2 for x in arr] # [1, 4, 9, 16, 25]"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function that takes a string and reverses the words."
},
{
"role": "assistant",
"content": "def reverseWords(text):\n return ' '.join(text.split()[::-1])\n\nreverseWords(t... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a SQL query to return the sum of all salaries."
},
{
"role": "assistant",
"content": "SELECT SUM(salary)\nFROM employees;"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a function that takes in two numbers as arguments and returns the product of the two."
},
{
"role": "assistant",
"content": "def multiply(x, y):\n return x*y"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Sum up the numbers in the array in Javascript."
},
{
"role": "assistant",
"content": "let sum = arr.reduce((total, num) => total + num);\nconsole.log(sum); // 15"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Using the given function, create a loop that counts from 0 to 9."
},
{
"role": "assistant",
"content": "for (let i = 0; i < 10; i++){\n printNum(i);\n}"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a JSON object with three key-value pairs."
},
{
"role": "assistant",
"content": "{\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"age\": 30\n}"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Count the number of characters in the string."
},
{
"role": "assistant",
"content": "len(text) # 12"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Generate a random number between 0 and 1 (inclusively)."
},
{
"role": "assistant",
"content": "Math.random(); // a random number between 0 and 1 (inclusively)"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Compose a function named average_list which takes a list of numbers as its argument and computes the average."
},
{
"role": "assistant",
"content": "def average_list(nums):\n retu... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Generate a snippet of code to extract all the URLs from the given string."
},
{
"role": "assistant",
"content": "import re\n\nstring = \"This string contains some urls such as https:... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a code to convert a given spredsheet in csv format to json format."
},
{
"role": "assistant",
"content": "import csv\nimport json\n\ndef csv_to_json():\n # Path of csv file\... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a list comprehension to generate a list of multiples of 3 from 0 to 23."
},
{
"role": "assistant",
"content": "list_of_multiples_of_3 = [x*3 for x in range(8)]"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Design a program to find the longest element in the given list."
},
{
"role": "assistant",
"content": "def longest_element(list):\n max_length = 0\n max_length_item = None\n\n for... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function to print all prime numbers between two given numbers."
},
{
"role": "assistant",
"content": "def print_prime_numbers_in_range(start, end):\n # start = starting numb... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Describe the basic syntax of a Java function?"
},
{
"role": "assistant",
"content": "A Java function consists of a function name, return type, parameters (arguments), and body. The s... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "How to reverse a list in C++?"
},
{
"role": "assistant",
"content": "You can reverse a list in C++ using the std::reverse algorithm. To reverse the list, pass the list as the first p... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a SQL query to update a value x in a column y in a table z."
},
{
"role": "assistant",
"content": "UPDATE payments \nSET amount = 5 \nWHERE payments.amount IS NOT NULL;"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write an algorithm in Python to determine if a number is even or odd."
},
{
"role": "assistant",
"content": "def is_even(num): \n if num % 2 == 0: \n return True \n else... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "What is the purpose of a constructor in a class in Java?"
},
{
"role": "assistant",
"content": "The purpose of a constructor in a class in Java is to initialize an object of that cla... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a JavaScript code to get the current browser URL."
},
{
"role": "assistant",
"content": "var currentURL = window.location.href;\nconsole.log(currentURL);"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Rewrite the following C++ code using only pointer references instead of array subscripts:"
},
{
"role": "assistant",
"content": "int arr[3] = {1,2,3};\nint sum = 0;\nint* ptr = arr;\... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a MySQL query to print the column names of a table named 'employees'."
},
{
"role": "assistant",
"content": "SELECT column_name FROM information_schema.columns WHERE table_name... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Generate a regular expression to match a valid email address."
},
{
"role": "assistant",
"content": "/^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$/"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "How to delete a particular row in an SQLite database table?"
},
{
"role": "assistant",
"content": "To delete a particular row in an SQLite database table, you can use the DELETE stat... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Is it possible to set a breakpoint that is not associated with any source code line in a GDB program?"
},
{
"role": "assistant",
"content": "Yes, it is possible to set a breakpoint t... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a C++ code to find the average of an array of integers."
},
{
"role": "assistant",
"content": "#include <iostream>\n\nint calculateAverage(int array[], int n){\n int sum = 0... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "How can we encrypt a string in Python?"
},
{
"role": "assistant",
"content": "We can encrypt a string in Python using the cryptography module. The cryptography module provides high l... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "What is the purpose of declaring a function as static in C++?"
},
{
"role": "assistant",
"content": "The purpose of declaring a function as static in C++ is to restrict its visibilit... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "How to print the elements of a two-dimensional array in C?"
},
{
"role": "assistant",
"content": "We can use nested loops to print the elements of a two-dimensional array in C. The o... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Using the following code, clean up the bugs and make sure the output functions correctly."
},
{
"role": "assistant",
"content": "def example_func(lst):\n output_lst = []\n for el... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a C++ function to generate a random integer between 0 and 10."
},
{
"role": "assistant",
"content": "#include <iostream> \n#include <cstdlib> \n#include <ctime> \nusing namespa... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a table to store customer information."
},
{
"role": "assistant",
"content": "CREATE TABLE customers (\n id int NOT NULL AUTO_INCREMENT,\n name varchar(100) NOT NULL,\n ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a class in Java named Puppy that has two instance variables, age and name and two methods, bark and sleep."
},
{
"role": "assistant",
"content": "public class Puppy { \n // ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Parse the string and return the number of unique alphabets in the string."
},
{
"role": "assistant",
"content": "int count = 0;\nfor (int i = 0; i < StringInput.length(); i++) {\n i... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a shell script to print the top 3 most frequently used commands."
},
{
"role": "assistant",
"content": "#!/bin/bash\n# Store all commands used in the last hour in command_list... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Read the JSON string below and convert it into a dictionary."
},
{
"role": "assistant",
"content": "import json\n\njsonObject = json.loads(jsonString)\ndictionary = dict(jsonObject)\... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Implement a function that finds the maximum element in a given array."
},
{
"role": "assistant",
"content": "def find_max_element(arr): \n max_element = arr[0] \n for index in ... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Validate whether the string contains only alphabets or not."
},
{
"role": "assistant",
"content": "def check_string_alphabets(myString):\n for character in myString:\n if (... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Rewrite the following code using ternary operator."
},
{
"role": "assistant",
"content": "num1 = 5\nnum2 = 10\n\nprint(\"num1 is smaller than num2\") if (num1 < num2) else print(\"nu... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a script to check if a given number is a palindrome or not."
},
{
"role": "assistant",
"content": "# Function to check whether the inputNumber is palindrome or not\ndef is_pali... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Edit the following code to remove the bugs."
},
{
"role": "assistant",
"content": "def reverse_string(user_string): \n reversed_string = ''\n if len(user_string) == 0: \n return... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "What is the output of the following code?"
},
{
"role": "assistant",
"content": "a\nbb\nccc"
}
] | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function to remove all whitespace characters from a given string."
},
{
"role": "assistant",
"content": "def remove_whitespaces(myString):\n return ''.join(myString.split(... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Edit the following code to add try catch block."
},
{
"role": "assistant",
"content": "x = \"5\"\ny = \"2\"\ntry:\n sum = int(x) + int(y)\n print(\"Sum of x and y is\", sum)\nexc... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a Python function that takes two lists of equal length and creates a dictionary of the elements in each list that have the same index."
},
{
"role": "assistant",
"content": "de... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a quick-sort algorithm in Python."
},
{
"role": "assistant",
"content": "def quick_sort(arr):\n \"\"\"Sort a list of numbers in ascending order using the Quick-Sort algorit... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Develop an algorithm to find the value of n where n is the index of the Fibonacci sequence."
},
{
"role": "assistant",
"content": "def nth_fibonacci_number(n):\n \"\"\"Find the va... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Create a program that finds all the prime numbers less than or equal to a given number."
},
{
"role": "assistant",
"content": "def find_primes(num):\n \"\"\"Find all the prime num... | curated_dataset |
chatml | [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "user",
"content": "Write a function that takes in a list of numbers and prints out the greatest number."
},
{
"role": "assistant",
"content": "def find_greatest(list):\n \"\"\"Print out the greatest... | curated_dataset |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 3