[output] | <html> <head> <title>Submission Form</title> </head> <body> <form> <label for="name">Name: </label> <input type="text" name="name" id="name" /> <label for="email">Email: </label> <input type="email" name="email" id="email" /> <input type="submit" value="Su [instruction] | Create an HTML page with a form that has two inputs: Name and Email. [input] |
[output] | SELECT product_id, SUM(quantity) AS total_sales FROM sales WHERE MONTH(order_date)='<month>' GROUP BY product_id; [instruction] | Write a SQL query that finds the TOTAL sales of each product in a given month. [input] | Table name: sales Columns: product_id, quantity, order_date
[output] | let employee = { name: 'John Doe', age: 25, position: 'Accountant' }; [instruction] | Create a JavaScript object that stores the properties of an employee. [input] | Name: John Doe Age: 25 Position: Accountant
[output] | p { font-style: italic; } [instruction] | Create a CSS style to display text in italics. [input] |
[output] | class Flower { var name: String var petals: Int var petalColor: String var pollenColor: String init(name: String, petals: Int, petalColor: String, pollenColor: String) { self.name = name self.petals = petals self.petalColor = petalColor se [instruction] | Create a swift class that describes a flower. [input] |
[output] | const name = jsonObj['name']; const locations = jsonObj['locations']; const degree = jsonObj['qualifications']['degree']; const university = jsonObj['qualifications']['university']; [instruction] | Fill in the below code to extract specific data from the given JSON object. [input] | const jsonObj = { 'name': 'John Doe', 'locations': ['Los Angeles', 'New York', 'Las Vegas'], 'qualifications': {'degree': 'Master', 'university': 'Stanford'} }
[output] | from django.contrib.auth.models import User users = User.objects.all() for user in users: print(user.username) [instruction] | Write a Django code to print the name of all the users in the database. [input] |
[output] | $(function() { $('#myElement').on('click', function(e) { $(this).fadeOut(300); }); }); [instruction] | Using jQuery, design an effect to fade out an element when clicked on. [input] |
[output] | #!/bin/bash while read line; do echo $line | sed -e "s/a/b/g" >> myfile.txt done < myfile.txt [instruction] | Write a bash script to replace all occurrences of the letter 'a' with the letter 'b' in 'myfile.txt'. [input] |
[output] | <div style="height: 100%; width: 100%; display: flex; flex-direction: row; background-color: #e8e8e8;"> <div style="flex: 1 1 auto; background-color: #d3d3d3; padding: 20px 0;"></div> <div style="flex: 1 1 auto; background-color: #cfcfcf; padding: 20px 0;"></div> </div> [instruction] | Using HTML and CSS, develop a two-column layout that has two different shades of the same color. [input] |
[output] | <!DOCTYPE html> <html> <head> <title>Random Password Generator</title> <script src="generate.js"></script> <style> body { background-color: lightblue; } #container { margin: 0 auto; width: 500px; background-color: white; padding: 30px [instruction] | Using HTML/CSS and JavaScript, construct a web page that generates a random password. [input] |
[output] | public static boolean hasDuplicates(int[] arr) { for (int i = 0; i < arr.length; i++) { for (int j = i + 1; j < arr.length; j++) { if (arr[i] == arr[j]) return true; } } return false; } [instruction] | Create a function in Java to check if a given array contains duplicates. [input] | int[] arr = {1, 2, 3, 2, 4, 5};
[output] | <form action="script.php" method="post"> <input type="text" name="name" placeholder="Name"> <input type="email" name="email" placeholder="Email"> <input type="submit" value="Submit"> </form> [instruction] | Write an HTML code for a form to submit data. [input] |
[output] | <script type="text/javascript"> $(document).ready(function(){ var str = "This is a sample string."; var words = str.split(" "); var longestWord = words.sort(function (a, b) { return b.length - a.length; })[0]; alert("The longest word is: "+longestWord); }); </ [instruction] | Write a jQuery code to find and display the longest word from a given string. [input] | var str = "This is a sample string."
[output] | val = 10 if val > 5: print("val is greater than 5") [instruction] | Translate this piece of JavaScript into Python. [input] | let val = 10; if (val > 5) { console.log("val is greater than 5"); }
[output] | new_arr = list(set(arr)) # [1, 2, 3, 4] [instruction] | Given the following array, remove all duplicates and return a new array with the remaining elements. [input] | arr = [1, 2, 4, 3, 3, 2]
[output] | The number of triplets in this array which sum up to zero is 1. The triplets are [-1, 0, 1]. [instruction] | Find the number of triplets in this array which sum up to zero. [input] | arr = [-1, 0, 1, 2, 3, 4]
[output] | Variable one: 12.34 Variable two: 21.103 [instruction] | Bring the following two variables into the same format [input] | Variable one: 12,34 Variable Two: 21.103
[output] | void ReverseString(char *str) { int length = 0; char temp; // calculate the length of string while (*str != 0) { length++; str++; } // the end of string str--; // swap first and last characters for (int i = 0; i < length/2; i++) [instruction] | Write a function in C++ to reverse a C-style String. [input] | // str is a c-style string char str[] = "Hello World!"
[output] | <div class="card"> <div class="card-header"> <h3>Welcome!</h3> </div> <div class="card-body"> </div> </div> [instruction] | Write a HTML code to design a card with the heading "Welcome!". [input] |
[output] | UPDATE a SET b = 20 WHERE a = 3; [instruction] | Write a SQL query to update the value of column b in the table called a. [input] | Table name: a Columns: a, b Current state of table a: a | b 1 | 10 2 | 11 3 | 12
[output] | my_list = ['a',"a",'b',1,1,1,'c'] my_dict = {} for i in my_list: my_dict[i] = my_dict.get(i, 0) + 1 print(my_dict) # Output: {'a': 2, 'b': 1, 1: 3, 'c': 1} [instruction] | Read the given input, and write a Python code to create a dictionary which contains unique elements as keys and their corresponding count as values. [input] | Input: ['a',"a",'b',1,1,1,'c']
[output] | for(int i=0; i<A.size(); i++) { if(A.get(i) %2 != 0) { A.remove(i); i--; } } [instruction] | Using variable A, write a code snippet in Java to iterate through ArrayList and delete odd values. [input] | // ArrayList A ArrayList<Integer> A = new ArrayList<>(Arrays.asList(1,2,3,4,5,6));
[output] | <table> <tr> <th>Column 1</th> <th>Column 2</th> </tr> <tr> <td>Row 1</td> <td>Row 1</td> </tr> <tr> <td>Row 2</td> <td>Row 2</td> </tr> <tr> <td>Row 3</td> <td>Row 3</td> </tr> <tr> <td>Row 4</td> <td>Row 4</td> </tr> </table> [instruction] | Write a HTML code to show a table with 2 columns and 4 rows. [input] |
[output] | def max_difference(A): return max(abs(np.max(A) - np.min(A)), abs(A[-1] - A[0])) [instruction] | Create a function in Python to evaluate the given numpy array and return the maximum absolute difference of any two elements. [input] | // Array A import numpy as np A = np.array([1, 4, 5, -3])
[output] | .button { background-color: black; color: white; border-radius: 5px; padding: 10px; } <button class="button">Greet</button> [instruction] | Write a CSS code to show a black colored button with the text "Greet". [input] |
[output] | def remove_short(mylist): mylist = [x for x in mylist if len(x) >= 3] return mylist print(remove_short(mylist)) # Output: ['Apple', 'Hello'] [instruction] | Create a function in Python to modify the given list and remove all strings with length less than three. [input] | mylist = ['Apple', 'Cat', 'Hello', 'Hi']
[output] | function getTripletsFromSum (x) { var triplet = []; for (var i = 1; i < x; i++) for (var j = i; j < x; j++) for (var k = j; k < x; k++) if (i*i + j*j === k*k && i + j + k === x) triplet.push(i, j, k); return triplet; } console.log(getTripletsFromSum(12)); # Output: [3 [instruction] | Write a function in JavaScript that takes in a number x and returns the pythagorean triplet whose sum is x. [input] | // Number x int x = 12;
[output] | def sort_strings(array): return sorted(array) [instruction] | Given an array of strings, sort the strings alphabetically. [input] | array = ["Banana", "Apple", "Orange"]
[output] | SELECT * FROM table_name ORDER BY column_name ASC [instruction] | Write a query that sorts data in a database. [input] |