← 목록

Synth · CodeAlpaca일부

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

[output] | arr = [1, 2, 1, 4, 5]; const uniqueItems = new Set(arr); console.log(uniqueItems.size); # Output 4 [instruction] | Find the number of unique items in the given array. [input] | arr = [1, 2, 1, 4, 5]

[output] | #!/bin/bash mkdir ~/new_dir [instruction] | Create a shell script to make a directory in the home directory. [input] |

[output] | import json # Reading data data = { "Name": "Text Analyzer", "Version": "1.0.0", "Author": "John Doe" } # Printing the value of the "Name" field print(json.dumps(data['Name'])) # Output Text Analyzer [instruction] | Read the given JSON data and display the value of the "Name" field. [input] | { "Name": "Text Analyzer", "Version": "1.0.0", "Author": "John Doe" }

[output] | import numpy as np arr = np.random.rand(3, 3) print(arr) # Output [[0.78000621 0.36251339 0.91162219] [0.52734163 0.56699849 0.03191476] [0.81245571 0.21147751 0.72691151]] [instruction] | Use NumPy to create a 3x3 array of random numbers from 0 to 1. [input] |

[output] | body { font-family: Arial, Helvetica, sans-serif; } [instruction] | Edit the existing CSS stylesheet by adding a regular font family rule. [input] |

[output] | <p>This is my first paragraph</p> <p>This is my second paragraph</p> [instruction] | Given the following HTML code, add a second paragraph. [input] | <p>This is my first paragraph</p>

[output] | let num1 = 8; let num2 = 0; if (num1 > num2) { console.log("num1 is greater than num2"); } else { console.log("num2 is greater than num1"); } [instruction] | Translate the following Python programme into JavaScript. [input] | num1 = 8 num2 = 0 if num1 > num2: print("num1 is greater than num2") else: print("num2 is greater than num1")

[output] | import nltk from nltk.sentiment.vader import SentimentIntensityAnalyzer sid = SentimentIntensityAnalyzer() ss = sid.polarity_scores(text) # Output {'neg': 0.0, 'neu': 0.49, 'pos': 0.51, 'compound': 0.7717} [instruction] | Analyze the given text using opinion mining. [input] | The new iPhone is awesome, I love it!

[output] | def factorial_recursion( n ): if n == 1: return n else: return n * factorial_recursion( n - 1 ) [instruction] | Write a function to compute the factorial of a number using recursion. [input] |

[output] | def factorial_while(n): factorial = 1 while n>0: factorial = factorial * n n = n - 1 return factorial [instruction] | Construct a program that can calculate the factorial of a number using a while loop [input] |

[output] | true [instruction] | Construct a code to determine if two strings are equal [input] | abc abc

[output] | def longest_substring(string): n = len(string) ''' Initialization of stings, a and b ''' a = "" b = "" ''' Initialization of maximum length substring having distinct characters ''' maxlen = 0 ''' 1. Pick starting point 2. intialise substrn [instruction] | Create a program to find the longest substring with unique characters [input] |

[output] | # A utility function to get the height of the tree def height(node): # Base Case : Tree is empty if node is None: return 0 ; # If tree is not empty then height = 1 + max of left # height and right heights return 1 + max(height(node.left) ,height(node.right)) [instruction] | Construct a function to detect if a binary tree is balanced [input] |

[output] | <?xml version="1.0" encoding="utf-8"?> <book> <title>The Adventures of Tom Sawyer</title> <author>Mark Twain</author> <year>1876</year> <genre>Fiction</genre> </book> [instruction] | Create a XML document to store information about books. [input] | Book Title: "The Adventures of Tom Sawyer" Book Author: Mark Twain Book Year: 1876 The Genre: Fiction

[output] | Insertion sort is a sorting algorithm in which each item of the array is inserted at its correct position in the sorted list. It involves scanning the array and comparing each element with its adjacent elements in the array. If the element is smaller than its neighbors, it is swapped with its left n [instruction] | How can you sort an array using insertion sort? [input] |

[output] | tup=(1,2,3,4,5,6,7,8,9,10) for i in range(0,5): print (tup[i]) [instruction] | Write a Python code that prints out the first 5 elements of a tuple. [input] |

[output] | The sum of a list of numbers in Python can be calculated using the built-in sum() function. This function takes an iterable object (such as a list or tuple) containing numbers as its argument and returns the sum of all the elements in the object. For example, sum([1,2,3]) will return 6. [instruction] | How do you calculate the sum of a list of numbers in Python? [input] |

[output] | function longestCommonSubstring(str1, str2) { let longestSubstring = ''; let longestStringLength = 0; for (let i = 0; i < str1.length; i++) { for (let j = 0; j < str2.length; j++) { let tempSubstring = ''; let k = i; while (str1[k] === str2[j]) { tempSubstring + [instruction] | Create a JavaScript function to find the length of the longest common substring between "apple" and "pineapple". [input] |

[output] | squares = {1:1, 2:4, 3:9, 4:16, 5:25, 6:36, 7:49, 8:64, 9:81, 10:100} [instruction] | Create a new Python dictionary with numbers 1-10 as keys and their corresponding squares as values. [input] |

[output] | SELECT FirstName FROM Employee; [instruction] | Create a SQL query to find all first names in the table 'Employee' [input] |

[output] | SELECT MAX(Salary) FROM Employee; [instruction] | Create a SQL query to get the highest salary in the table 'Employee' [input] |

[output] | <!DOCTYPE html> <html> <head> <title>My page</title> </head> <body> <form> <input type="text" name="name" placeholder="Name"> <input type="text" name="email" placeholder="Email"> <input type="submit" value="Submit"> </form> </body> </html> [instruction] | Write an HTML page with an input form having two text input fields [input] |

[output] | def check_array(arr): if len(arr) == 0: return False for str in arr: if len(str) == 0: return False return True [instruction] | Write a Python function that takes an array of strings as an argument and returns a boolean. [input] |

[output] | SELECT * FROM Customers LIMIT 3; [instruction] | Write a SQL statement to retrieve the first three customers from a table. [input] |

[output] | SELECT * FROM table_name WHERE `name` LIKE '%John%'; [instruction] | Select all the records from a SQL table where the `name` column contains the value `John`. [input] |

[output] | SELECT title, year FROM movies ORDER BY year ASC LIMIT 1; [instruction] | Write a SQL query to get the title and year of the oldest movie in a database. [input] |

[output] | #include <stdio.h> // Function to find maximum int max_of_three(int x, int y, int z) { int max = x; if (y > max) max = y; if (z > max) max = z; return max; } // Driver program int main() { int x = 3, y = 4, z = 6; printf("%d", max_of_three(x [instruction] | Implement a function in C that given inputs x, y and z, return the largest of them. [input] | x = 3, y = 4, z = 6

[output] | var languages = [ {langName: "JavaScript", creator: "Brendan Eich", releaseYear: 1995}, {langName: "Python", creator: "Guido van Rossum", releaseYear: 1991}, {langName: "C", creator: "Dennis Ritchie", releaseYear: 1972}, {langName: "Java", creator: "James Gosling", releaseYear: 1995} [instruction] | Create an array of objects in JavaScript that contains five objects, each representing a different programming language. [input] |

[output] | //Mapper Code import java.io.IOException; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class MapperClass extends Mapper<LongWritable, Text, Text, LongWritable> { LongWritable one = new LongWritable(1); T [instruction] | Build a MapReduce job with Hadoop to find the 99th percentile of a given data set. [input] |

[output] | let letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" for letter in letters { print(letter) } [instruction] | Create a Swift program to display the letters of the English alphabet in ascending order. [input] |

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