← 목록

Synth · CodeAlpaca일부

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

[output] | import math output = math.sqrt(25) [instruction] | Compute the square root of the number 25 and store the output in a variable called 'output'. [input] |

[output] | arr = [3, 4, 5, 2, 5, 1, 5] arr = [x for x in arr if x != 5] [instruction] | What is the command to delete all occurrences of the element "5" from a given Python array? [input] |

[output] | d = { "name": "Dave", "age": 32, "country": "Australia" } [instruction] | What is the command to add a new key-value pair ("country": "Australia") to the following dictionary? [input] | { "name": "Dave", "age": 32 }

[output] | for c in string: print(c) [instruction] | What is the command to print all the characters in a given string? [input] |

[output] | list_length = len(list) [instruction] | What is the command to find the length of a given list? [input] |

[output] | SELECT * FROM employees WHERE name = 'John'; [instruction] | Construct a query to find all records in the table with a particular value. [input] | Table Name: employees Value: John

[output] | my_string <- "Hello World" [instruction] | Create a variable in R and assign it with a string value of "Hello World". [input] |

[output] | No errors present. [instruction] | Compile the given piece of code and identify any errors. [input] | int main() { cout << "Hello World!"; return 0; }

[output] | document.getElementById("name").disabled = true; [instruction] | Write JavaScript code to disable a form element with an id of 'name'. [input] |

[output] | 1. Take two variables, say x and y. 2. Assign x the value of the first element in the list and y the value of the second element. 3. Compare x and y. 4. If x > y, swap them. 5. Now x is the smallest and move to the next element in the list. Repeat from step 2 with y and new element. 6. At the end [instruction] | Formulate an algorithm that helps you arrange a given set of numbers in ascending order. [input] | [7, 4, 8, 9, 11]

[output] | public class ArmstrongNumber { public static void main(String[] args) { int number = 407; // sample input // calculate the length of the number int lengthOfNumber = String.valueOf(number).length(); int tempNumber = number; int sum = 0; while (tempNumber != 0) { i [instruction] | Develop a Java program to check if an input number is an Armstrong number. [input] |

[output] | # Program to print the prime numbers between 1 and 50 for num in range(1, 51): # prime numbers are greater than 1 if num > 1: for i in range(2, num): if (num % i) == 0: break else: print(num) [instruction] | Design a program to generate prime numbers between 1 and 50. [input] |

[output] | for (int i = 0; i <= 10; i++) { System.out.println(i); } [instruction] | Generate a for loop in Java for printing integers from 0 to 10. [input] |

[output] | void PrintString(string my_string) { Console.WriteLine(my_string); } PrintString("my_string"); [instruction] | Create a procedure in C# to print a string. [input] | my_string

[output] | SELECT name, age FROM Employee; [instruction] | Design an SQL query for displaying the names and ages of all employees. [input] | Employee table with the columns "name" and "age"

[output] | const kvPairs = Object.entries(object); // [['a', 1], ['b', 2], ['c', 3]] [instruction] | Boil down a JavaScript object into an array of key-value pairs. [input] | object = {a: 1, b: 2, c: 3}

[output] | foreach (int num in numbers) { if (num % 3 == 0) { Console.WriteLine(num); } } [instruction] | Construct a for loop in C# for picking out numbers that are divisible by 3. [input] | numbers = [1, 2, 3, 4, 5, 6, 7]

[output] | SELECT name FROM Student WHERE age = 18; [instruction] | Write a SQL query for listing students who are 18 years old. [input] | Student table with the columns "name" and "age"

[output] | def multiply_three(a, b, c): return a * b * c multiply_three(4, 5, 6) # returns 120 [instruction] | Design a function in Python for computing the multiplication of 3 numbers. [input] | 4, 5, 6

[output] | const employee = { name: 'John Doe', occupation: 'Programmer' } [instruction] | Develop a JavaScript object for storing the name and occupation of an employee. [input] | name = 'John Doe', occupation = 'Programmer'

[output] | SELECT AVG(salary) FROM Employee; [instruction] | Make an SQL query for calculating the average salary of employees. [input] | Employee table with the column "salary"

[output] | def areaTriangle( side1, side2, side3): # calculate the semi-perimeter s = (side1 + side2 + side3) / 2 # calculate the area area = (s*(s-side1)*(s-side2)*(s-side3)) ** 0.5 return area # Driver code side1 = 12 side2 = 15 side3 = 10 # calculate area area = areaTriangle [instruction] | Write code in Python to calculate the area of a triangle given 3 sides. [input] | side1 = 12 side2 = 15 side3 = 10

[output] | import nltk from nltk.sentiment import SentimentIntensityAnalyzer sentence = "The movie was terrible and boring." analysis = SentimentIntensityAnalyzer() score = analysis.polarity_scores(sentence) if score["compound"] >= 0.5: output = "positive" else: output = "negative" print("The sentime [instruction] | Write a script in Python that can classify a sentence as positive or negative. [input] | The movie was terrible and boring.

[output] | #include<stdio.h> //Function to calculate L(w) double Fun(double w){ double Le = 14 * (w * w) + 8 * w - 7; return Le; } //Function to calculate w(t+1) using Gradient descent double GradientDescent(double w, double alpha){ double w_next; w_next = w - alpha * Fun(w); return w_n [instruction] | Write a function in C that minimizes the cost of a given parameter using gradient descent. [input] | The parameter is w(t+1) = w(t) - alpha * Le(w) Here, alpha= 0.3 and Le(w) = 14w^2 + 8 * w - 7

[output] | #include<stdio.h> int main(){ int n=5; int i; int arr[n]; //Adding elements in array for(i=0;i<n;i++){ arr[i] = i + 20; } //Printing elements in array for(i=0;i<n;i++){ printf("Number %d: %d\t", i+1, arr[i]); } return 0; } [instruction] | Edit the given C program to print the output in a tabular form using printf. [input] | #include<stdio.h> int main(){ int n=5; int i; int arr[n]; //Adding elements in array for(i=0;i<n;i++){ arr[i] = i + 20; } //Printing elements in array for(i=0;i<n;i++){ printf("%d\n",arr[i]); } return 0; }

[output] | SELECT * INTO Customers FROM Orders; [instruction] | Write a SQL code to generate a new table called "Customers" by selecting all columns from the "Orders" table. [input] |

[output] | #!/bin/bash numlist="25 3 1 2 46 4 5 21 7 9 6 10" for i in $numlist do if [[ $i =~ [0-9][0-9] ]] then echo "Number $i" fi done [instruction] | Edit the given Bash script to output only the lines with double digit numbers. [input] | #!/bin/bash numlist="25 3 1 2 46 4 5 21 7 9 6 10" for i in $numlist do echo "Number $i" done

[output] | # Create a vector data <- c("A", "B", "C", "A", "A", "B", "E", "C", "A", "B") # Generate frequency table freq <- table(data) # Print the result print(freq) [instruction] | Write an R program to generate a frequency table for the given data. [input] | data <- c("A", "B", "C", "A", "A", "B", "E", "C", "A", "B")

[output] | #!/bin/bash echo "FileName: File1" cat File1.txt [instruction] | Combine the following two commands into a single shell script. [input] | echo "FileName: File1" cat File1.txt

[output] | let getGreeting = (name) => { return `Hello, ${name}`; } let outputElement = document.getElementById("output"); let getName = () => { return "John"; } const render = (message, element) => { element.innerHTML = message; } render(getGreeting(getName()), outputElement); [instruction] | Create an API by combining the given HTML and JavaScript code. [input] | <!DOCTYPE html> <html> <head> <title>Test API</title> </head> <body> <div id="output"></div> <script> let name = "John"; document.getElementById("output").innerHTML = `Hello, ${name}`; </script> </body> </html>

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