← 목록

Synth · CodeAlpaca일부

총 20,022개 · 페이지 453/668
🔀 랜덤
불러오는 중…

[output] | def get_sum(*args): sum = 0 for number in args: sum += number return sum [instruction] | Edit the existing code to accept more than two arguments [input] | def get_sum(a, b): return a + b

[output] | SELECT * FROM `user_table` WHERE date_created > date_sub(curdate(), interval 3 day) [instruction] | Construct a SQL query to select all the records from the "user_table" table that were created in the last 3 days. [input] |

[output] | In order to access a requested item from an URL in JavaScript you can use the URL API such as the URL.searchParams API. The API allows you to parse the query string and retrieve specific items, such as variables and their values, from the URL. For example, if the URL was "http://example.com/?key1=va [instruction] | How can you access a requested item from an URL in JavaScript? [input] |

[output] | The main advantages of using a while loop over a for loop in Python are that it is more concise and allows the user to have better control over the iteration process. For example, the while loop allows the user to specify an exit condition if a certain condition is met, mid-way through the loop. Fur [instruction] | What are the advantages of using a while loop over a for loop in Python? [input] |

[output] | import markdown import re def convert_html_to_markdown(html): lines = html.split('\n') for line in lines: line = markdown.markdown(line) # remove HTML tags line = re.sub(r'<[^>]*>', '', line) # strip whitespace line = line.strip() print line html = '<p>This is an exampl [instruction] | Write a code to convert HTML to Markdown using Python. [input] |

[output] | In order to access an element in an array using JavaScript, you can use the index of the element. The index is the position of the element in the array. For example, if the array is [4, 8, 15], then you can use the following code to access the element at index 1 (i.e. 8): var array = [4, 8, 15]; va [instruction] | How can you access an element in an array using JavaScript? [input] |

[output] | The maximum length of a string in Python is sys.maxsize, which is typically 2^63 - 1 on a 64-bit machine. This means that the maximum length of a string is 18,446,744,073,709,551,615 characters. [instruction] | What is the maximum length of a string in Python? [input] |

[output] | SELECT * FROM Customers WHERE Email LIKE 'Simon%'; [instruction] | Write a query in SQL to find all customers with email addresses starting with 'Simon'. [input] |

[output] | public static void Sort(int[] numbers) { int n = numbers.Length; for (int i = 0; i < n - 1; i++) for (int j = 0; j < n - i - 1; j++) if (numbers[j] > numbers[j + 1]) { int temp = numbers[j]; numbers[j] = numbers[j + 1]; [instruction] | Implement a sorting algorithm in C# that sorts the numbers in increasing order. [input] | numbers = [3, 7, 5, 2, 4, 1]

[output] | const request = require('request'); const url = "http://www.example.com"; request.get(url, (error, response, body) => { var data = JSON.parse(body); console.log(data); }); [instruction] | Write an API call in Node.js to get JSON data from the given URL. [input] | URL = http://www.example.com

[output] | def greater_num(a,b) if a > b puts a else puts b end end [instruction] | Write a function in Ruby which takes two parameters and prints the greater one. [input] |

[output] | <div style="text-align: center;"> <h1>Hello World!</h1> <p>This is a paragraph</p> </div> [instruction] | Edit the given HTML code to center all the elements. [input] | <div> <h1>Hello World!</h1> <p>This is a paragraph</p> </div>

[output] | if ($num % 2 == 0) { // even } else { // odd } [instruction] | Write a conditional statement in PHP to check if a variable is even or odd. [input] |

[output] | <style> * { text-align: right; } </style> [instruction] | Create a web page with all the elements aligned on the right, using only CSS. [input] |

[output] | import math radius = 5 area = math.pi * (radius**2) print("The area of the circle is", area) [instruction] | Compute the area of the circle where the radius is 5 inches in Python. [input] |

[output] | Random random = new Random(); string randomHex = string.Format("{0:X}", random.Next()); [instruction] | Generate a random hexadecimal value in C#. [input] |

[output] | public class Pyramid { public static void printPyramid(int height) { int i, j; for (i=0; i<height; i++) { for (j=0; j<=i; j++) { System.out.print("* "); } System.out.println(); } [instruction] | Write a Java program to display a pyramid with the given height. [input] | height = 3

[output] | SELECT * FROM table_name ORDER BY name ASC; [instruction] | Write a SQL query to sort records in a table alphabetically by a column 'name'. [input] |

[output] | <?php function getChecksum($string) { // Get the seed used $seed = (string) md5($string); $checkSum = 0; // Calculate the checksum foreach(str_split($string) as $char){ $checkSum += ord($char)*$seed[$checkSum % 32]; } [instruction] | Create a PHP script to generate a valid checksum of a given string. [input] |

[output] | The capital of Costa Rica is San José. [instruction] | Use the provided knowledgebase to answer the following question: What is the capital of Costa Rica? [input] | https://en.wikipedia.org/wiki/Costa_Rica

[output] | f = open('grammar_corpus.txt', 'r') # Create an empty list to store the corpus corpus = [] # Loop through the file line by line for line in f: # Split the line into words words = line.lower().strip().split() # Check if the word is an english word if words[1].isalpha(): [instruction] | Use the provided dataset to create a Corpus of English words in Python. [input] | https://storage.googleapis.com/download.tensorflow.org/data/grammar_corpus.txt

[output] | def extract_num(string): return [word for word in string.split() if word.isdigit()] [instruction] | Write a Python method to extract only the numeric values from a string. [input] |

[output] | <?php $root_dir = $_SERVER['DOCUMENT_ROOT']; echo $root_dir; ?> [instruction] | Write a PHP code to get the root directory of the server. [input] |

[output] | SELECT student_id, AVG(score) AS average_score FROM student_scores GROUP BY student_id; [instruction] | Generate SQL query to find the average score for each student. [input] | Table: student_scores | id | student_id | score | |-----|------------|-------| | 1 | 111 | 5 | | 2 | 111 | 7 | | 3 | 223 | 6 | | 4 | 223 | 8 |

[output] | def remove_vowels(string): vowels = 'aeiouAEIOU' new_string = '' for char in string: if char not in vowels: new_string += char return new_string [instruction] | Design a function using Python to remove all vowels from a string. [input] |

[output] | public class Fibonacci { public static long Fibonacci(int n) { if (n <= 1) { return n; } return Fibonacci(n - 1) + Fibonacci(n - 2); } } [instruction] | JAVA code to calculate the Fibonacci number at a given position. [input] |

[output] | <html> <head> <title>User Data</title> </head> <body> <h1>User Data</h1> <p>Name: John</p> <p>Age: 25</p> <p>Address: 123 Main Street</p> </body> </html> [instruction] | Create a HTML page to show user data from a REST API. [input] | { "name": "John", "age" : 25, "address" : "123 Main Street" }

[output] | fun main() { for(i in 1..10) { println(i) } } [instruction] | Create a Kotlin program which prints out all the numbers between 1 and 10. [input] |

[output] | We can use the dynamic programming approach to solve this problem. At each step, we calculate the maximum possible sum that can be obtained if we include the current element. We keep track of the maximum sum found so far, and then continue with the next element. At the end, we have the highest sum o [instruction] | Suggest a suitable algorithm for solving this problem. [input] | An array of integers is given. Find the highest sum that can be obtained by including different members from the array, such that no two members have the same index.

[output] | import random def random_num_gen(start, end): return random.randint(start, end) [instruction] | Code a function in Python to generate random numbers within a given range. [input] |

← → 방향키로 페이지 이동 · 숫자 입력 후 Enter로 점프