← 목록

Synth · CodeAlpaca일부

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

[output] | ^[a-zA-Z]{4}$ [instruction] | Create a regex expression that matches all strings with four alphabetic characters. [input] |

[output] | SELECT AVG(salary) FROM employees GROUP BY age; [instruction] | Create a SQL query to group the table by age and calculate the average salary of each group. [input] | Table name: employees Fields: name (varchar(255)), age (int), salary (int)

[output] | The HAVING clause is used in SQL to restrict the results of a query based on a set of conditions. It filters records that are returned from the GROUP BY clause, and is used in conjunction with aggregate functions used in the SELECT clause. It is similar to the WHERE clause, but WHERE is used to filt [instruction] | What is the purpose of the SQL HAVING clause? [input] |

[output] | function findPrimes(range) { let primes = []; for (let i=range[0]; i< range[1]; i++) { if (checkPrime(i)) { primes.push(i); } } return primes; } function checkPrime(num) { for (let i=2; i<=Math.sqrt(num); i++) { if (num % i == 0) { return false; } } return [instruction] | Construct a JavaScript program to find all the prime numbers within a range of numbers [input] | range = [2,10]

[output] | def sumOfSquares(n): sum = 0 for i in range(1, n+1): sum += i*i return sum [instruction] | Create a function to find the sum of the squares of all natural numbers up to a certain number. [input] | n = 10

[output] | import re html_code = ''' <a href="https://example.com/about">About</a> <a href="https://example.com/products">Products</a> ''' links = re.findall(r'href="(.*?)"', html_code) print(links) # Output: ['https://example.com/about', 'https://example.com/products'] [instruction] | Parse the following HTML code to get all the hyperlinks in the page. [input] | <a href="https://example.com/about">About</a> <a href="https://example.com/products">Products</a>

[output] | import java.util.StringTokenizer; public class WordCounter { public static int countWords(String str) { StringTokenizer tokenizer = new StringTokenizer(str); return tokenizer.countTokens(); } public static void main(String[] args) { String st [instruction] | Write a java code to take a string as input and return the number of words present in it. [input] |

[output] | import torch # Load the dataset train_data, valid_data, test_data = torch.utils.data.random_split(dataset, (1000, 400, 200)) # Build the model model = torch.nn.Sequential( torch.nn.Linear(7, 15), torch.nn.ReLU(), torch.nn.Linear(15, 4), torch.nn.Softmax() ) # Compile the model [instruction] | Train a model in PyTorch to classify the following dataset into 4 classes. [input] |

[output] | abc [instruction] | Delete all duplicated characters in a string. [input] | String: abcabcabc

[output] | SQL databases store data in predefined tables and use structured query language (SQL) for querying the data. In contrast, NoSQL databases are designed to store large amounts of unstructured data and are commonly used for distributed data processing. Unlike SQL, NoSQL databases are known for their fl [instruction] | Compare and contrast SQL and NoSQL databases. [input] |

[output] | Naive Bayes classification is a supervised machine learning technique used for classification tasks which is based on the Bayes Theorem. It assumes that each input feature is independent of each other, which is called the assumption of "naive" Bayes. The algorithm uses prior knowledge of the data se [instruction] | What is Naive Bayes classification? [input] |

[output] | * ** *** **** ***** [instruction] | Write a code snippet to print a right aligned triangle of asterisks. [input] | Length: 5

[output] | A long identifier name is important for programming as it clearly and accurately describes the purpose of the identifier. It is easier for another programmer to understand what a specific code does if the identifier names are descriptive of their purpose. Long and descriptive names also make the cod [instruction] | What is the significance of a long identifier name in programming? [input] |

[output] | A programmer can optimize a code to improve its performance by using techniques like loop optimization, code refactoring, resource optimization, cache optimization, and parallel computing. Loop optimization involves reducing the number of iterations in loops, using variables instead of literals, rem [instruction] | How can a programmer optimize a code to improve its performance? [input] |

[output] | The purpose of an exception handler is to catch and handle any unexpected errors that may occur while code is executing. It is a code block which is used to detect and handle runtime errors when they occur. This allows the code to immediately handle the error, thus avoiding a crash and providing the [instruction] | What is the purpose of using an exception handler? [input] |

[output] | Debugging helps a programmer by identifying the source of errors or bugs in the program. Through debugging, a programmer can pinpoint exactly where the issue is, rather than having to spend time searching through lines of code trying to find the problem. Debugging also allows a programmer to make we [instruction] | How does debugging help a programmer? [input] |

[output] | function createmultiplicationTable(n) { for ( var i = 1; i <=10; i++ ) { document.write(n+" x "+i+" = "+n*i,"<br>"); } } createmultiplicationTable(n); [instruction] | Generate a multiplication table for a given number in JavaScript. [input] | n = 5;

[output] | def adjacency_matrix_to_list(A): """ Convert an adjacency matrix to an adjacency list Parameters ---------- A: 2D list representing an adjacency matrix Returns ------- adj_list: Adjacency list """ n = len(A) adj_list = [[] for i in range(n)] [instruction] | Build a function to convert an adjacency matrix into an adjacency list. [input] | A = [[0, 1, 0, 0], [1, 0, 1, 1], [0, 1, 0, 0], [0, 1, 0, 0]]

[output] | Lists are used to store an ordered collection of elements, but they are not suitable for storing key-value pairs of data because they don't provide an efficient way to look up values associated with specific keys. Dictionaries provide a more efficient way to store key-value pairs of data, as they us [instruction] | Explain why we use a Dictionary instead of Lists when we need to store multiple pairs of data (key-value pair)? [input] |

[output] | a = 11 b = 23 [instruction] | Mark the output of the following two lines of C++ code [input] | int a = 10; int b = ++a + ++a;

[output] | \w[aeiouAEIOU]\d+ [instruction] | Write a Regular Expression to match any line with vowels followed by numbers [input] |

[output] | def unique_subsets_count(given_set): """ Find the number of unique subsets of a given set Parameters ---------- given_set: Set of elements Returns ------- count: Number of unique subsets """ count = 1 << len(given_set) return [instruction] | Find the number of unique subsets of a given set [input] | given_set = {1, 2, 3}

[output] | .main { margin: 0 auto; width: 50%; text-align: center; } [instruction] | Design a CSS class to center align a div with class name "main". [input] |

[output] | var person = { name: 'John Doe', age: 26, location: 'New York' }; [instruction] | Create a JavaScript object with the keys "name", "age", and "location". [input] |

[output] | CREATE DATABASE flower_shop; [instruction] | Write a MySQL query to create a database called "flower_shop". [input] |

[output] | #import the required modules import xml.etree.ElementTree as ET # parse the given xml document tree = ET.parse('document.xml') root = tree.getroot() # iterate over all the elements in the document for book in root.findall('book'): title = book.find('title').text author = book.f [instruction] | Parse the given XML document. [input] | <?xml version="1.0" encoding="UTF-8"?> <bookstore> <book> <title>A Game of Thrones</title> <author>George R. R. Martin</author> <price>9.99</price> </book> <book> <title>A Clash of Kings</title> <author>George R. R. Martin</author> <price>12.99</price> </book>

[output] | #!/bin/bash # Display free memory echo "Free Memory:"; free -h; # Get disk partitions with available disk space echo "Available disk space:" df -h; # Get CPU utilization info echo "CPU Utilization: " top -bn1 | grep "Cpu(s)" | \ sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | \ awk '{prin [instruction] | Write a shell script to monitor the usages of CPU and RAM. [input] |

[output] | # create Django project django-admin startproject car_database # create Django app cd car_database django-admin startapp cars # Add 'cars' to INSTALLED_APPS in settings.py INSTALLED_APPS = ( ... 'cars', ) # Create models.py file class Car(models.Model): model = models.Cha [instruction] | Develop a Django application to store car model, make and year in the database. [input] |

[output] | # install packages install.packages("ggplot2") # import required libraries library(ggplot2) # data movies <- c(5, 7, 9, 8, 12, 11) months <- c("January", "February", "March", "April", "May", "June") # create dataframe object data <- data.frame(months, movies) # plot ggplot(data, a [instruction] | Generate a bar chart in R using the given dataset. [input] | Number of Movies Watched in the Last 6 Months Month Number January 5 February 7 March 9 April 8 May 12 June 11

[output] | // To store data localStorage.setItem("name", "John Doe"); // To get data var name = localStorage.getItem("name"); // To remove data localStorage.removeItem("name"); [instruction] | Use HTML web storage to exchange data between a web page and the server. [input] |

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