← 목록

Synth · CodeAlpaca일부

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

[output] | import tweepy # create OAuth handler consumer_key = "YOUR_CONSUMER_KEY" consumer_secret = "YOUR_CONSUMER_SECRET" access_token = "YOUR_ACCESS_TOKEN" access_token_secret = "YOUR_ACCESS_TOKEN_SECRET" # authenticate auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(acce [instruction] | Write a Python code to fetch the top three trending topics from Twitter. [input] |

[output] | import nltk sentence = "This is a sentence." tokens = nltk.word_tokenize(sentence) print(tokens) # Output: ['This', 'is', 'a', 'sentence', '.'] [instruction] | Use the NLTK library to tokenize the following sentence. [input] | sentence = "This is a sentence."

[output] | { "name": "John Doe", "age": 21, "gender": "" } [instruction] | Add a new field to the json object. [input] | { "name": "John Doe", "age": 21 }

[output] | - Design the website architecture to ensure proper scalability - Implement user authentication & authorization - Develop Front-end Interface for User Interaction - Build responssive front-end using Cascading Style sheets (CSS) & HTML - Compile application & deploy on web servers - Connect datab [instruction] | Generate a list of project requirements for a web development project. [input] |

[output] | One way of detecting if there is an infinite loop in a code is by using a counter to count the number of iterations the loop is performing. If the number of iterations exceeds some predefined threshold value, we can conclude that the code is executing an infinite loop. Another technique to detect an [instruction] | How can you detect if there is an infinite loop in a code? [input] |

[output] | function maxProps(objects) { let maxProps = 0; let maxObject; for (let i = 0; i < objects.length; i++) { let size = Object.keys(objects[i]).length; if (size > maxProps) { maxProps = size; maxObject = objects[i]; } } return ma [instruction] | Write a JavaScript program to find the object has the largest number of properties. [input] |

[output] | \b(((https?|ftp|file):\/\/|www\.)[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]) [instruction] | Construct a regex to find urls in a given string. [input] |

[output] | { "name": "John Doe", "age": 33, "gender": "Male" } [instruction] | Generate a valid JSON object from the given input content. [input] | Name: John Doe Age: 33 Gender: Male

[output] | <p>Hello World</p> [instruction] | Wrap the given text in a tag. [input] | Hello World

[output] | SELECT item_name, price FROM products ORDER BY price DESC LIMIT 3; [instruction] | Construct a SQL query to find out three most expensive items in a product table. [input] |

[output] | - <html> - <title> - <head> - <body> - <header> - <nav> - <main> - <article> - <section> - <aside> - <footer> - <h1>, <h2>, <h3>, ... <h6> - <p> - <ul>, <ol> - <li> - <div> - <span> - <img> - <table> - <tr>, <th>, <td> [instruction] | Generate a list of valid HTML tags used to structure content in a page. [input] |

[output] | { "name": "John Doe", "age": 33, "gender": "Male" } [instruction] | Represent the given content into a well-formatted JSON structure. [input] | Name: John Doe Age: 33 Gender: Male

[output] | def search(items, item): for i in range(len(items)): if items[i] == item: found = i if found: return found else: return -1 [instruction] | Complete the program by filling in the missing code to call the appropriate function [input] | def search(items, item): for ____ in ____: if ____ == ____: found = ____ if ____: return found else: return -1

[output] | 3 + 3 = 6 4 + 2 = 6 [instruction] | Given two lists of integers, find all unique pairings where the sum of the pair equals to a given number. [input] | list1 = [1, 2, 3, 4] list2 = [2, 3, 4, 5] number = 6

[output] | arrayBool = [False]*10 [instruction] | Create an array of 10 Boolean values and set it to "False". [input] |

[output] | def draw_triangle(n): for i in range(0, n): for j in range(0, i+1): print("*",end="") print("\r") [instruction] | Create a program that draws a triangle with stars (*) with a given height. [input] |

[output] | def permutations(string): result = [] if len(string) == 1: result=[string] else: for i, letter in enumerate(string): for perm in permutations(string[:i] + string[i+1:]): result.append(letter + perm) return result [instruction] | Create a program that prints all unique permutations of the given string. [input] |

[output] | public class Division { public static void main(String[] args) { int a = 8; int b = 2; double result = (double) a / b; int roundedResult = (int) Math.round(result); System.out.println(roundedResult); } } [instruction] | Create a Java program that divides two integers and rounds the result to the nearest integer. [input] | int a = 8; int b = 2;

[output] | int maxDepth(TreeNode* root) { if (root == NULL) return 0; else { // compute the depth of each subtree int lDepth = maxDepth(root->left); int rDepth = maxDepth(root->right); // use the larger one if (lDepth > rDepth) [instruction] | Calculate the maximum depth of a Binary Search Tree. [input] | TreeNode* root = new TreeNode(3); root->left = new TreeNode(2); root->right = new TreeNode(7); root->left->left = new TreeNode(1); root->left->right = new TreeNode(5); root->right->left = new TreeNode(6); root->right->right = new TreeNode(8);

[output] | function triangleArea(side_1, side_2, side_3) {     var s = (side_1 + side_2 + side_3) / 2;     var area = Math.sqrt(s * (s - side_1) * (s - side_2) * (s - side_3));     return area; } console.log(triangleArea(5,6,7)); // 14.697 [instruction] | Writing a function to calculate the area of a triangle where the three sides are given. [input] | side1 = 5, side2 = 6, side3 = 7

[output] | .bold-font {     font-weight: bold;     font-style: normal; } [instruction] | Create a CSS class for making a font bold. [input] |

[output] | int[] array = new int[10]; Arrays.fill(array, 0); [instruction] | Write a code to initialize an array with 10 elements of value 0. [input] |

[output] | document.getElementById('button1').style.color='blue'; [instruction] | Write a JavaScript code snippet to update the style color attribute of a HTML element. [input] | elementID = button1

[output] | function sayHello(str){ console.log(str); } sayHello('Hello'); [instruction] | Change the following code to a function using parameters. [input] | print(“hello”)

[output] | const addTwo = num => num + 2; [instruction] | Change the following code to an ES6 arrow function. [input] | function addTwo(num) { var result; result = num + 2; return result; }

[output] | print("Hello, World!") [instruction] | Output "Hello, World!" to the console. [input] |

[output] | for s in arr: print(s) [instruction] | Output the contents of an array of strings to the console. [input] | arr = ["apple", "orange", "banana"]

[output] | def print_string(s): print(s) [instruction] | Create a function that prints the string passed to it as an argument. [input] |

[output] | SELECT Name FROM Users; [instruction] | Create an SQL query to extract the name of all users. [input] |

[output] | movie = { title: "The Godfather", year: 1972, director: "Francis Ford Coppola", genre: "Crime drama" } [instruction] | Create a Ruby hash containing information about a movie. [input] |

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