← 목록

Synth · CodeAlpaca일부

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

[output] | CREATE PROCEDURE select_customers AS BEGIN SELECT * FROM customers; END; [instruction] | Create a stored procedure in SQL for selecting all the records from a customers table. [input] |

[output] | A backtracking algorithm is an algorithmic technique that is used to find all (or some) solutions to a problem by incrementally building a solution and testing it against the given constraints. If the solution is not feasible or the constraints are not satisfied, the algorithm takes a step back and [instruction] | Explain what is meant by a backtracking algorithm. [input] |

[output] | ``` def remove_characters(name, characters): for c in characters: name = name.replace(c, '') return name name = "Alice" characters = ["A", "e"] ``` [instruction] | Fix the following code so that it works without errors. [input] | ``` def remove_characters(name, characters): for c in characters: name.replace(c, '') return name name = "Alice" characters = ["A", "e"] ```

[output] | [0, 1, 4, 6, 7, 9] [instruction] | Sort the list of numbers by increasing order. [input] | [4, 6, 0, 1, 7, 9]

[output] | def sum_of_odd_integers(n,m): total_sum = 0 for i in range(m,m+(2*n-1),2): total_sum += i return total_sum [instruction] | Write the code for a function that takes two parameters n and m and returns the sum of the first n odd integers starting with m. [input] |

[output] | 4 [instruction] | Determine how many elements in the list are greater than zero. [input] | [2, -1, -5, 6, 7]

[output] | import random def create_random_array(): lst = [] for i in range(4): lst.append(random.randint(1,10)) return lst [instruction] | Write the code to create a one-dimensional array and initialize it with random numbers of length 4. [input] |

[output] | def merge_two_arrays(arr1, arr2): merged_arr = arr1 + arr2 return merged_arr [instruction] | Write the code to produce a new array that includes all elements from two given arrays. [input] |

[output] | class Animal: def make_sound(self): """Makes a sound specific to the animal.""" pass def eat(self): """Eats food.""" pass [instruction] | Create a class with the name "Animal" and add the methods "make_sound" and "eat". [input] |

[output] | import java.sql.Connection; import java.sql.DriverManager; String host = "localhost"; int port = 3306; String username = "user"; String password = "password"; String database = "sampledb"; String connectionString = "jdbc:mysql://"+host+":"+port+"/"+database; Connection connection = DriverManager.g [instruction] | Connect to a remote database using a JDBC connection. [input] | host:localhost port: 3306 username: user password:password database: sampledb

[output] | # Find the inverse of the given matrix A = [[1,2], [3,4]] inverse_A = [[round(A[1][1]*A[0][0] - A[0][1]*A[1][0]), round(-A[1][0]*A[0][0] + A[0][1]*A[1][1])], [round(-A[1][1]*A[0][1] + A[0][0]*A[1][0]), round(A[1][1]*A[0][1] - A[0][0]*A[1][0])]] print(inverse_A) # [[4,-2],[ [instruction] | Find the inverse of the given matrix [input] | [ [1, 2], [3, 4] ]

[output] | # Replace words with corresponding synonyms in the given text text = "The cat is lazy and likes to sleep." # Replace the word text = text.replace("sleep", "nap") print(text) # "The cat is lazy and likes to nap." [instruction] | Replace words with corresponding synonyms in the given text [input] | text: "The cat is lazy and likes to sleep." word: "sleep" synonym: "nap"

[output] | .section __DATA, "rw" arraylength: .int 2 array: .int 0, 1 .text .global _start _start: mov r1, #0 loop: sub r2, r1, #1 add r3, array, r2 ldr r2, [r3] sub r3, r1, #2 add r4, array, r3 ldr r3, [r4] add r5, r2, r3 add r3, array, r1 str r5, [r3] ldr r1, =arrayle [instruction] | Write an assembly language program to generate a Fibonacci series with n number of elements. [input] |

[output] | let string = "Hello, World!" let separator = "," let array = string.components(separatedBy: separator) print(array) // ["Hello", " World!"] [instruction] | Write a Swift code to split a string into an array of strings by a specific separator. [input] | let string = "Hello, World!" let separator = ","

[output] | array = [4, 5, 2, 8, 9]; number = 6; % Count the number of elements in the array that are greater than the given number count = 0; for i=1:length(array) if array(i) > number count = count + 1; end end disp(count); % Output: 2 [instruction] | Write a MATLAB code to count how many element in an array is greater than a given number. [input] | array = [4, 5, 2, 8, 9]; number = 6;

[output] | SELECT COUNT(*) FROM traffic WHERE type = 'website' AND date = '<date>' [instruction] | Create a SQL query gives the total counts of a particular type of traffic on a given website [input] |

[output] | The sum of the first 10 positive integers is 55. [instruction] | Find the sum of the first 10 positive integers [input] |

[output] | from datetime import datetime def get_current_datetime(): # Get the current date and time current_datetime = datetime.now() # Print the current date and time print("Current date and time:", current_datetime) # Call the function get_current_datetime() [instruction] | Develop a code to get the current date and time and print it [input] |

[output] | A: 00 B: 01 C: 10 D: 11 [instruction] | Generate a Huffman code for a given set of symbols and probabilities [input] | Symbols: ['A', 'B', 'C', 'D'] Probabilities: [0.2, 0.3, 0.3, 0.2]

[output] | A suitable machine learning algorithm for predicting the next seven days of weather would be an Long Short Term Memory (LSTM) Recurrent Neural Network (RNN). An LSTM RNN can be trained on historical weather data to learn the patterns and relationships between various weather variables. By utilizing [instruction] | Suggest a machine learning algorithm suitable for predicting the next seven days of weather [input] |

[output] | A suitable optimisation algorithm for a minimisation problem is Gradient Descent. Gradient Descent works by calculating the gradient of the cost function with respect to the input variables. This gradient is then used to update the input variables in order to reduce the cost. The process is repeated [instruction] | Suggest an optimisation algorithm for a minimisation problem [input] |

[output] | # Node class class Node: # Function to initialise the node object def __init__(self, data): self.data = data # Assign data self.next = None # Initialize next as null # Linked List class class LinkedList: # Function to initialize head def __init__(self): self.head = None # F [instruction] | Write a python code to insert a new node at the head of a linked list [input] |

[output] | def sum_range(start, end): res = 0 for i in range(start, end+1): res += i return res sum_range(1, 10) [instruction] | Given a range of numbers, write a python program to find the sum of the elements within that range. [input] | range: 1 to 10

[output] | def calculate_diff(arr): return abs(arr[0] - arr[1]) def calculate_minimum_difference(nums): if len(nums) <= 1: return 0 min_diff = float('inf') for x in range(1, len(nums)): min_diff = min(min_diff, calculate_diff(nums[x-1:x+1])) return min_diff [instruction] | Decompose the following code into two different functions. [input] | def calculateMinimumDifference(nums): if len(nums) <= 1: return 0 min_diff = float('inf') for x in range(1, len(nums)): min_diff = min(min_diff, abs(nums[x] - nums[x-1])) return min_diff

[output] | def count_cases(s): num_lower = 0 num_upper = 0 for char in s: if char.islower(): num_lower += 1 elif char.isupper(): num_upper += 1 return num_lower, num_upper [instruction] | Count and return the number of lowercase and uppercase characters in a given string. [input] | my_str = "Hello World!"

[output] | def remove_duplicates(arr): final_list = [] for i in arr: if i not in final_list: final_list.append(i) return final_list [instruction] | Create a function that takes a list of strings as an argument and returns a list containing only non-duplicate strings. [input] | my_list = ["Apple", "Orange", "Grapes", "Apple", "Watermelon"]

[output] | The unit of measurement for the average speed of a car is kilometers per hour (km/h) or miles per hour (mph). [instruction] | What is the unit of measurement for the average speed of a car? [input] |

[output] | SELECT * FROM Employees ORDER by Salary DESC LIMIT 1; [instruction] | Create a SQL query that returns the records with the highest salary from the Employees table. [input] | Employees table columns: id | name | salary 1 | John | 120000 2 | Jane | 150000 3 | Jack | 160000

[output] | SELECT name, salary FROM Employees WHERE salary > 100000; [instruction] | Create a SQL query that returns the names and salaries of all employees who are earning more than $100,000. [input] | Employees table columns: id | name | salary 1 | John | 120000 2 | Jane | 150000 3 | Jack | 160000

[output] | body { background-color: gray; } h1 { text-align: center; } [instruction] | Create a CSS stylesheet for a webpage that centers the heading and makes the background color gray. [input] |

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