← 목록

Synth · CodeAlpaca일부

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

[output] | Mammal: dog, elephant Reptile: snake, turtle [instruction] | Classify the given animals into two categories: mammal or reptile [input] | [dog, snake, turtle, elephant]

[output] | Name_list = [name for name in input_list if name[0] == 'A'] [instruction] | Create a new list object by selecting the names that start with a ‘A’ from the given list [input] | [Alfred, John, Anthony, Paula]

[output] | SELECT job_type, COUNT(*) FROM table_name GROUP BY job_type; [instruction] | Generate a valid SQL query to get the total number of people in each job type [input] |

[output] | print("The answer is " + str(10 - 5)) [instruction] | Edit the following Python code to print out “The answer is X” [input] | print("X + 5 = 10")

[output] | import turtle t = turtle.Turtle() t.forward(100) t.left(90) t.forward(50) t.left(90) t.forward(100) t.left(90) t.forward(50) t.left(90) [instruction] | Create a rectangle using the turtle library in Python [input] |

[output] | <table> <tr> <th>Col1</th> <th>Col2</th> </tr> <tr> <td>One</td> <td>Alpha</td> </tr> <tr> <td>Two</td> <td>Beta</td> </tr> <tr> <td>Three</td> <td>Gamma</td> </tr> </table> [instruction] | Build a HTML table using the given JSON data [input] | data = { "col1": ["One", "Two", "Three"], "col2": ["Alpha", "Beta","Gamma"] }

[output] | String name = "John"; System.out.println("Length of string is: " + name.length()); [instruction] | Edit the following Java code so that it will output the length of a string [input] | String name = "John"

[output] | In JavaScript, inheritance is an object-oriented programming concept where an object inherits the properties and methods from its parent object. To illustrate this concept, consider the example of a Person being a parent object and a Student being the child object. The Person object would have prope [instruction] | Use JavaScript to illustrate the concept of inheritance with an example. [input] |

[output] | df = pd.DataFrame({"A": [12,15,20], "B": [30,25,35], "C": [40,45,50]}) [instruction] | Create a pandas dataframe containing the following columns and their respective values: [input] | A, B, C A= 12, 15, 20 B= 30, 25, 35 C= 40, 45, 50

[output] | Rome is one of the oldest cities in the world, having been founded in 753 BCE by Romulus and Remus. Following its founding, Rome quickly developed into a powerful city-state, establishing the Roman Republic in 509 BCE and the Roman Empire in 27 BCE. During its reign, Rome significantly expanded its [instruction] | Summarize the article 'X' in one or two paragraphs. [input] | Article 'X': This article is about the history of the city of Rome. Rome was founded in 753 BCE by two brothers, Romulus and Remus. Since then, Rome has been a powerful city that has played a huge role in the formation of Western civilization. The Roman Republic was established in 509 BCE, and the

[output] | gcc -o filename filename.cpp [instruction] | Compile a C++ program using gcc. [input] | filename.cpp

[output] | The index of the first occurrence of 'data' is 4. [instruction] | Find the index of the first occurrence of the word 'data' in the text 'The data here is important'. [input] |

[output] | <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="*"> <xsl:element name="{local-name()}"> [instruction] | Write an XSLT code to transform an XML document into HTML. [input] |

[output] | matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]] [instruction] | Construct a matrix using the given list of numbers. [input] | numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

[output] | def Fibonacci(n): if n<0: print("Incorrect input") # First Fibonacci number is 0 elif n==1: return 0 # Second Fibonacci number is 1 elif n==2: return 1 else: return Fibonacci(n-1)+Fibonacci(n-2) [instruction] | Given a positive integer number, generate the Fibonacci series. [input] |

[output] | <button id="my-button">Click Me</button> [instruction] | Create a HTML button with an id of "my-button". [input] |

[output] | def matrix_multiplication(*matrices): res = [[0 for _ in range(len(matrices[0][0]))] for _ in range(len(matrices[0]))] for y in range(len(matrices[0])): for x in range(len(matrices[0][0])): for m in range(len(matrices)): res[y][x] += matrices[m][y] [instruction] | Make a matrix multiplication program that takes an arbitrary number of matrices as input. [input] |

[output] | def print_primes(start, end): for num in range(start, end + 1): # all prime numbers are greater than 1 if num > 1: for i in range(2, num): if (num % i) == 0: break else: print(num) [instruction] | Write a computer program to print all primes in an inputted range. [input] |

[output] | public class MainActivity extends AppCompatActivity { EditText radiusEditText; TextView outputTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); radiusEditText [instruction] | Create an Android app to accept user input and calculate the area of a circle. [input] |

[output] | [3, 4, 5, 6] [instruction] | Select the overlapping elements between two lists [input] | list1 = [1, 2, 3, 4, 5, 6] list2 = [3, 4, 5, 6, 7, 8]

[output] | def search(list, item): for i in range(len(list)): if list[i] == item: return True return False [instruction] | Implement a function for searching an item in the given list. [input] | list = [1, 4, 5, 6, 8, 9] item = 5

[output] | import re def isValidEmail(string): # regex to check for valid email address regex = '^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$' if(re.search(regex,string)): return True else: return False [instruction] | Create a function that takes a string and checks if it's a valid email or not. [input] | string = 'example[at]gmail.com'

[output] | def removeDuplicates(list): # create a new set with unique elements from list unique_set = set(list) # convert set back to list unique_list = list(unique_set) return unique_list [instruction] | Write a function for removing duplicates from a given list [input] | list = [1, 2, 3, 3, 4, 2]

[output] | for row in A: for elem in row: print(elem, end=' ') print() [instruction] | Write a code to print out a two-dimensional array. [input] | A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

[output] | def countTextDifference(str1, str2): # store length of both strings len1 = len(str1) len2 = len(str2) # store the number of characters # which are different count = 0 # compare and count the number # of characters which are different for i [instruction] | Compare two strings and count the number of characters that are different. [input] | str1 = 'hello' str2 = 'hallo'

[output] | result = {} for name in names: # get the first letter from the name first_letter = name[0] result[name] = first_letter print(result) # {'John': 'J', 'Max': 'M', 'Alice': 'A'} [instruction] | Generate a dictionary with the name of the person as key and the cower letter of their name as value. [input] | names = ['John', 'Max', 'Alice']

[output] | def compare_strings(string1, string2): """Compare two strings and return True if both strings have the same number of characters.""" if len(string1) == len(string2): return True else: return False [instruction] | Compare two strings and return true if both strings have the same number of characters. [input] | string1 = "hello" string2 = "world"

[output] | def palindrome_check(word): """Check if a given word is a palindrome.""" # reverse the given word reversed_word = word[::-1] if word == reversed_word: return True else: return False [instruction] | Write code to determine if a word is a palindrome or not. [input] | word = "noon"

[output] | def char_to_ascii(character): """Convert a character to its ASCII code.""" ascii_code = ord(character) return ascii_code [instruction] | Create a function to convert a character to its ASCII code. [input] | character = 'a'

[output] | def get_max_value(d): """Calculate the maximum value in a dictionary.""" max_value = 0 for key in d: if d[key] > max_value: max_value = d[key] return max_value [instruction] | Calculate the maximum value in a dictionary. [input] | d = {'a': 1, 'b': 3, 'c': 5}

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