← 목록

Synth · CodeAlpaca일부

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

[output] | #!/bin/bash for day in {1..31}; do echo "$day" done [instruction] | Create a bash script that prints out the days in a month. [input] |

[output] | <html> <table> <thead> <tr> <th>Year</th> <th>Make</th> <th>Model</th> </tr> </thead> </table> </html> [instruction] | Construct an HTML table that contains the following headers: "Year", "Make", "Model". [input] |

[output] | let exampleObject = { name: 'Bob', age: 26, pet: true }; [instruction] | Create an object with the following properties, `name` of type `string`, `age` of type `number`, and `pet` of type `boolean`. [input] |

[output] | {2, 4, 7, 9} [instruction] | Print the symmetric difference of two sets. [input] | set1 = {1, 2, 3, 4, 5}, set2 = {1, 3, 5, 7, 9}

[output] | Stored in the form of a Pandas dataframe. 0 1 2 3 a 'NA' b 'NA' 4 'NA' 5 6 [instruction] | Replace NaN values in the given dataframe with a string. [input] | Stored in the form of a Pandas dataframe. 0 1 2 3 a NaN b NaN 4 NaN 5 6

[output] | 3.0 [instruction] | Compute the mean of all the values in a column of a given dataframe. [input] | Stored in the form of a Pandas dataframe. 0 1 2 a 1 b 4 4 5

[output] | def contains_hello(input_string): return "hello" in input_string [instruction] | Construct a boolean check to detect if a given string contains the word "hello". [input] |

[output] | def is_balanced(input_string): stack = [] for char in input_string: if char == '(': stack.append(char) elif char == ')': if len(stack) == 0: return False else: stack.pop() return len(stack) == 0 [instruction] | Develop an algorithm that checks for balanced parentheses in a given string. [input] |

[output] | 10 [instruction] | Estimate how many words are present in the given text. [input] | The world of technology is rapidly evolving each day.

[output] | ["Ada", "Chris", "David", "Elsa", "Frank"] [instruction] | Construct a program to filter the list of names based on the given condition. [input] | names = ["Ada", "Bob", "Chris", "David", "Elsa", "Frank"] condition: length greater than 4

[output] | [instruction] | Estimate the area of a shape using data from the given Pandas dataframe. [input] | Stored in the form of a Pandas dataframe. 0 1 2 a 5 b 4 4 5

[output] | The machine learning model can be designed as a sequence of layers built with Keras, followed by a dense layer with two units – one for sports and one for food, and a softmax activation function to achieve the final output. We can feed the model with a dataset consisting of article texts labeled as [instruction] | Design a machine learning model to classify an article as either a sports article or a food article. [input] |

[output] | const countCharacter = (str, char) => { let count = 0; for (let i = 0; i < str.length; i++) { if (str.charAt(i) === char) { count += 1; } } return count; } // example call let str = "hello world"; let char = "l"; let count = countCharacter(str, char); console.log(count); // 3 [instruction] | Write a JavaScript function that counts the number of times a given character appears in a string. [input] |

[output] | The web scraper can be designed using the Python library BeautifulSoup. The scraper can take a url of a wiki article as an argument and extract the text content using the method find_all('p'). The text content of the article can then be extracted using the get_text() method. [instruction] | Design a web scraper in Python to extract the text content from Wikipedia articles. [input] |

[output] | The component can be implemented in the following way: <template> <div> <table> <tr v-for="row in rows"> <td v-for="item in row">{{item}}</td> </tr> </table> </div> </template> <script> export default { name: 'TableComponent', props: { rows: { [instruction] | Implement a Vue component that displays a table layout. [input] |

[output] | The designed neural network model can be implemented with an embedding layer followed by a convolutional layer and then a global max-pooling layer. The output of the pooling layer can be passed through a fully connected layer with a sigmoid activation function to achieve the final output of the mode [instruction] | Design a neural network model to detect the sentiment of a given sentence. [input] |

[output] | The data structure to store a list of courses with their corresponding details can be a Python dictionary. The keys can be the course codes and the corresponding value can be a dictionary with the details of the course such as the name, number of credits, and description. Example: course_list = { [instruction] | Design a data structure to store a list of courses with their corresponding details. [input] |

[output] | #include<iostream> using namespace std; int main() { int a, b; cin>>a>>b; // change "," to ">>" cout<<"The product is "<<a*b; return 0; } [instruction] | Debug the following C++ program. [input] | #include<iostream> using namespace std; int main() { int a, b cin>>a,b; cout<<"The product is "<<a*b; return 0; }

[output] | public static void printMax(int[] arr) { int max = arr[0]; for (int i = 1; i < arr.length;i++) { max = (arr[i] > max) ? arr[i] : max; } System.out.println(max); } [instruction] | Create a Java function that takes an integer array as a parameter and prints out the maximum element of the array. [input] | [1, 5, 9, 10, 12]

[output] | SELECT name FROM students WHERE enrolled_in = 'Physics' AND enrolled_in = 'Math'; [instruction] | Write a SQL query to find the names of the people who are enrolled in both Physics and Math classes. [input] |

[output] | def avg(arr): sum = 0 for num in arr: sum += num return sum/len(arr) numbers = [3, 7, 11, 15] average = avg(numbers) print("Average of the numbers:",average) // Output: 9.5 [instruction] | Write a code snippet to compute the average of a set of integers. [input] | [3, 7, 11, 15]

[output] | my_list = range(1, 11) output = 0 for i in my_list: output += i print(output) #55 [instruction] | Read the given Python code and generate the output for the following input. [input] | my_list = range(1, 11)

[output] | let str = "hello world"; str = str[0].toUpperCase() + str.slice(1); [instruction] | Edit the given JavaScript code to convert the input string’s first letter to uppercase. [input] | let str = "hello world";

[output] | my_list = [1, 2, 5, 4, 2, 1, 5] count = 0 for i in my_list: if i == 5: count += 1 print(count) #2 [instruction] | Write a Python program to count how many times a given element appears in the list. [input] | my_list = [1, 2, 5, 4, 2, 1, 5]

[output] | <?php $my_list = [18, 22, 10, 27]; $divisible = False; foreach ($my_list as $num){ if($num % 5 == 0){ $divisible = True; break; } } echo $divisible; [instruction] | Create a PHP script to iterate through a list of numbers and determine if any of the numbers are divisible by 5. [input] | my_list = [18, 22, 10, 27]

[output] | my_list = [2, 5, 7, 9] for (let i = 0; i < my_list.length; i++) { my_list[i] = my_list[i] + 1; } console.log(my_list); // [3, 6, 8, 10] [instruction] | Edit the following program to add 1 to each element of the list and print the result. [input] | my_list = [2, 5, 7, 9]

[output] | function reverse_string(string){ let reversed = ''; for(let i = string.length - 1; i >= 0; i--){ reversed += string[i]; } return reversed; } let input = "hello world"; console.log(reverse_string(input)); // dlrow olleh [instruction] | Read the following JavaScript code and add an appropriate input field for the function. [input] |

[output] | public class CombineStrings { public static void main(String[] args) { String string1 = "hello"; String string2 = "world"; String string3 = "!"; String output = string1 + string2 + string3 ; System.out.println(output); //hello world! } } [instruction] | Write a Java program to take in 3 strings and combine them into one. [input] | string1 = "hello" string2 = "world" string3 = "!"

[output] | my_list = [5, 10, 15, 20] total = 0 for num in my_list: total += num print(total) #50 [instruction] | Edit the following code to take in a list of numbers and output the sum of all numbers in the list. [input] | my_list = [5, 10, 15, 20]

[output] | public class Palindrome { public static boolean isPalindrome(String s) { int i = 0, j = s.length()-1; while (i < j) { if (s.charAt(i) != s.charAt(j)) return false; i++; j--; } return true; } [instruction] | Create a Java program to determine whether a given string is a palindrome. A palindrome is a string which reads the same forwards and backwards. [input] |

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