← 목록

Synth · CodeAlpaca일부

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

[output] | .main-heading { color: red; } [instruction] | Using CSS, change the text color of all elements with class “main-heading” to red. [input] |

[output] | @keyframes moveLeftToRight { 0% { left: 0px; } 100% { left: 100%; } } .animation-element { position: relative; animation: moveLeftToRight infinite linear; } [instruction] | Create an animation using CSS that moves an element from left to right on an infinite loop. [input] |

[output] | function isPositive(num) { return num > 0; } [instruction] | Edit the following function to allow it to accept negative numbers. [input] | function isPositive(num) { return num >= 0; }

[output] | def findDivisibleBySix(n): result = [] for i in range(1, n+1): if i % 6 == 0: result.append(i) return result [instruction] | Write a Python program to find all numbers from 1 to the given number n which are divisible by 6. [input] |

[output] | SELECT name, age, gender FROM students WHERE age > 18; [instruction] | Write a SQL statement that selects the name, age and gender of every student in the database with age greater than 18. [input] |

[output] | import time def convert_date_to_timestamp(d): return time.mktime(time.strptime(d, "%m/%d/%Y")) [instruction] | Convert a date in the format "MM/dd/yyyy" to a timestamp. [input] | 04/23/2021

[output] | import random def generate_rand_str(): return ''.join(random.choices(string.ascii_letters + string.digits, k=5)) [instruction] | Generate a five digit random string. [input] |

[output] | class Person { constructor(name, age) { this.name = name; this.age = age; } outputInfo() { console.log(`Name: ${this.name}, Age: ${this.age}`); } } [instruction] | Create a JavaScript class that represents a person and ouputs their name and age to the console. [input] |

[output] | def get_primes_in_range(a, b): primes = [] for num in range(a, b + 1): if all(num % i != 0 for i in range(2, num)): primes.append(num) return primes [instruction] | Find all the prime numbers within a given range. [input] | 2, 20

[output] | <table> <tr> <th>Column1</th> <th>Column2</th> <th>Column3</th> <th>Column4</th> </tr> <tr> <td>Row1</td> <td>Row1</td> <td>Row1</td> <td>Row1</td> </tr> <tr> <td>Row2</td> <td>Row2</td> <td>Row2</td> <td>Row2</td> </tr> <tr> <td>Row3 [instruction] | Create a HTML table element with 4 columns and 5 rows. [input] |

[output] | def print_string_reverse(str): if not str: return else: print_string_reverse(str[1:]) print(str[0], end='') [instruction] | Design a recursanve function in Python that prints a given string in reverse. [input] | hello

[output] | " is " [instruction] | Find the string between two substrings. [input] | String: This is a string Start substring: is End substring: a

[output] | String value = '123' [instruction] | Parse the following XML data and print the value of the 'id' key as a string. [input] | <root> <id>123</id> <name>John Doe</name> </root>

[output] | Subject (she) + Verb (felt) + Adverb (so) + Adjective (excited) + Conjunction (that) + Subject (her application) + Verb (got) + Object (approval). [instruction] | Determine the syntactic structure of the following sentence. [input] | Sentence: She felt so excited that her application got approval.

[output] | (fusion|explosion|elision)$ [instruction] | Use the regular expression to extract the words ending with 'sion'. [input] | String: fusion, explosion, elision

[output] | { "name": "John Doe" } [instruction] | Construct a JSON object from the given key-value pair. [input] | Key-Value Pair: name:John Doe

[output] | int [] arr = {4, 8, 12, 16, 20}; [instruction] | Construct an array from the given set of numbers. [input] | Set of numbers: [4, 8, 12, 16, 20]

[output] | list = [1, 2, 3] list.append(4) # Adding new element [instruction] | Edit the given code to add a new element to the list. [input] | list = [1, 2, 3]

[output] | <!DOCTYPE html> <html> <head> <title>Buttons</title> </head> <body> <input type="button" value="Button 1" /> <input type="button" value="Button 2" /> </body> </html> [instruction] | Create an HTML page containing two buttons. [input] |

[output] | class Animal: def __init__(self, name, type, age): self.name = name self.type = type self.age = age [instruction] | Create a class called "Animal" containing three attributes - name, type and age. [input] |

[output] | Sub search_interface() Dim sh As Worksheet, sh2 As Worksheet Set sh = ThisWorkbook.Sheets("Sheet1") Set sh2 = ThisWorkbook.Sheets("Sheet2") For Each row In sh.Rows If row.Cells(1, 1) = "Search Term" Then Exit For End If If row.Cells(1, 1) = sh2.Cells(1, 2) Then For col = 1 [instruction] | Write VBA for a search interface to pull information from one tab of an excel sheet to a different tab [input] |

[output] | def average_age(people): total_age = 0 for p, a in people: total_age += a return total_age/len(people) [instruction] | Generate code to calculate the average age of a group of people. [input] | [["Person", "Age"], ["Jim",26], ["John", 39], ["Tracy",19]]

[output] | sum_series = 0; for i = 1:100 sum_series = sum_series + 1/i^2; end fprintf('The sum if the series is: %f\n',sum_series); [instruction] | Create a Matlab program to find the sum a given series [input] | The given series is 1 + 1/4 + 1/9 + ...

[output] | public class MatrixMultiplication { // Method to multiply two matrices public static double[][] multiply(double[][] A, double[][] B) { int aRows = A.length; int aColumns = A[0].length; int bRows = B.length; int [instruction] | Create a Java program to multiply two given matrices [input] |

[output] | class myIterator: def __init__(self, data): self.data = data self.index = 0 def __iter__(self): return self def __next__(self): if self.index >= len(self.data): raise StopIteration item = self.data[self.index] self [instruction] | Define an iterator class in Python. [input] |

[output] | class myContextManager: def __init__(self, name): self.name = name print("Context Manager initialized.") def __enter__(self): print("Entering context.") return self def __exit__(self, type, value, traceback): print(f"Exiting conte [instruction] | Create a class in Python that can be used as a context manager. [input] |

[output] | def contains(value, head): current_node = head while current_node is not None: if current_node.value == value: return True current_node = current_node.next return False [instruction] | Write a function to check whether a linked list contains a given value. [input] |

[output] | dict(arr) # Result: {'apple': 1, 'banana': 2, 'orange': 3} [instruction] | Consolidate the following array into a dictionary [input] | arr = [("apple", 1), ("banana", 2), ("orange", 3)]

[output] | def FindMax(arr): curr_max = arr[0] curr_index = 0 for i in range(len(arr)): if arr[i] > curr_max: curr_max = arr[i] curr_index = i return curr_max, curr_index if __name__ == "__main__": arr = [10, 7, 8, 11, 15] curr_max, curr_index = FindMax( [instruction] | Write a Python program to implement Find-Max algorithm. [input] | arr = [10, 7, 8, 11, 15]

[output] | def nestedListSum(nested_list): total = 0 for sub_list in nested_list: total += sum(sub_list) return total [instruction] | Define a function in Python that calculates the sum of the sum of the elements of a nested list. [input] |

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