[output] | arr = [0] * 10 [instruction] | Initialize a new array to 0 of size 10. [input] |
[output] | The language most closely associated with the Linux operating system is C. [instruction] | What language is most closely associated with the Linux operating system? [input] |
[output] | INSERT INTO table_name (name, age) VALUES ('John', 34) [instruction] | Store the data in a database using SQL. [input] | data: name="John", age=34
[output] | matrix = [[1, 2], [3, 4], [5, 6]] [instruction] | Convert the given vector into a 3x2 matrix. [input] | vector = [1, 2, 3, 4, 5, 6]
[output] | string = string.replace("My website", "John's website") [instruction] | Replace the string "My website" with the string "John's website" in the given sentence. [input] | string: My website is the best
[output] | Object-Oriented Programming languages allow objects to share tasks and data through the use of inheritance. [instruction] | What feature of an Object-Oriented Programming language allows its objects to share tasks and data? [input] |
[output] | Linear regression is a statistical technique used for predictive modeling. It attempts to find the line of best fit for a set of data by minimizing the sum of squares between the estimated line and observed data points. The equation of the line of best fit gives an estimate of the dependent variable [instruction] | Explain what is linear regression. [input] |
[output] | def remove_punctuation(sentence): punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~''' no_punct = "" for char in sentence: if char not in punctuations: no_punct = no_punct + char return no_punct [instruction] | Write a code to remove all punctuations from the given sentence. [input] | The quick, brown! fox jumped@ over the lazy- dog.
[output] | def get_domain_name(url): parsed_url = urlparse(url) return parsed_url.netloc [instruction] | Write a code to parse a URL and return the domain name. [input] | https://example.com/page
[output] | for(let i = 0; i < arr.length; i++){ if (arr[i] % 2 !== 0 ){ console.log(arr[i]); } } [instruction] | Create a loop that prints all the odd numbers from a given array. [input] | let arr = [1, 2, 3, 4, 5, 6, 7, 8]
[output] | array.sort((a, b) => b - a); [instruction] | Sort the array so that it is in descending order. [input] | let array = [7, 4, 5, 9, 1]
[output] | let newArr = arr.map(x => x * 2); [instruction] | Produce a new array by multiplying all numbers in the initial array by 2. [input] | let arr = [1, 4, 6, 8]
[output] | SELECT * FROM customers WHERE state = 'California'; [instruction] | Write a query to find all records in the customers table that have a state of "California" [input] |
[output] | let strArray = str.split(' '); [instruction] | Create a list of strings from a given string. [input] | let str = "hello world!"
[output] | """ Function to copy a 2D array. """ def copy_2d_array(arr): """Returns a copy of the given 2D array.""" copied_arr = [] for sublist in arr: copied_arr.append(list(sublist)) return copied_arr if __name__ == "__main__": array = [[1, 2, 3], [4, 5, 6]] print(copy_2d_arr [instruction] | Implement a function that copies a 2D array. [input] | array = [[1, 2, 3], [4, 5, 6]]
[output] | """ Split a string in such a way that all spaces, punctuation, and special characters are removed from the output. """ def split_string(mystring): """ This function splits the string into words, removing all of the spaces, punctuation, and special characters. """ # Remove all no [instruction] | Split a string in such a way that all spaces, punctuation, and special characters are removed from the output. [input] | mystring = 'My,string:is-Awes 0me*!'
[output] | """ Explain what a Python dictionary is. """ A Python dictionary is a collection of key-value pairs. Each key is associated with a single value, and each key is unique. Dictionaries are mutable, meaning that their values can be changed after they are created. Dictionaries are commonly used for stor [instruction] | Explain what a Python dictionary is. [input] |
[output] | SELECT state, product, MAX(revenue) AS revenue FROM Sales GROUP BY state, product; [instruction] | Write a SQL query to find the highest selling product in each state. [input] | Sales(state, product, revenue)
[output] | <div style="width:100px; height:100px; background-color:green"></div> [instruction] | Create a HTML code to show a green square with a width of 100px and a height of 100px. [input] |
[output] | h2 { font-size: 22px; font-weight: bold; font-family: Arial, sans-serif; line-height: 1.2; color: #333; text-align: center; } [instruction] | Create a CSS script to format the text in an h2 element. [input] |
[output] | <?php echo date("l, F jS") ?> [instruction] | Create an PHP script to display the current date and day. [input] |
[output] | <div style="width: 100px; height: 100px; background: red; border-radius: 50%;"></div> [instruction] | Create a HTML page to show a red circle with a border radius of 50%. [input] |
[output] | <html> <head> <title>Table of Words</title> </head> <body> <table border="1"> <tr> <th>Word</th> </tr> <tr> <td>Hello</td> </tr> <tr> <td>World</td> </tr> </table> </body> </html> [instruction] | Construct a HTML page which displays a table with all words of a given string. [input] | string = "Hello World"
[output] | def indexof(nums, target): for i in range(len(nums)): if nums[i] == target: return i return -1 [instruction] | Create a program which takes an array of integers and an integer as input, and returns the index of the integer in the array. [input] | array = [1, 2, 3, 4]; number = 3;
[output] | for i in range(1, 6): print(i * 7) [instruction] | Create a program in Python to print the first 5 multiples of a number [input] | Number: 7
[output] | Sub FindLastRowNY() LastRow = Range("A1").End(xlDown).Row For i = LastRow To 1 Step -1 If Cells(i, 2).Value = "New York" Then MsgBox i Exit Sub End If Next i End Sub [instruction] | Write a VBA code to return the last row where a certain value appears [input] | Table Name: Employees Column Name: State Value: New York
[output] | for index, row in df.iterrows(): # do something with each row [instruction] | Construct a loop in Python that iterates through each row of a dataframe [input] | Dataframe: df
[output] | for (int i = 0; i < arr.length; i++) { for (int j = i + 1; j < arr.length; j++) { if (arr[i] > arr[j]) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } } [instruction] | Update the following code in Java for sorting an array [input] | int arr[] = {10, 7, 8, 9, 1, 5};
[output] | int asciiValue(char c) { int value = int(c); return value; } [instruction] | Create a function in C++ to find the ASCII value of a character [input] |
[output] | for (int i = 0; i < str.Length; i++) { str[i] = char.ToLower(str[i]); } [instruction] | Construct a for-loop in C# to convert a string to lower cas [input] |