← 목록

Synth · CodeAlpaca일부

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

[output] | def print_info(data): print("Name: " + data['name']) print("Age: " + str(data['age'])) [instruction] | Write a function to print a user's name and age from a given dictionary. [input] | user_data = {'name':'John Doe', 'age': 24 }

[output] | class BankAccount: def __init__(self, name, balance): self.name = name self.balance = balance def deposit(self, amount): self.balance += amount def withdraw(self, amount): self.balance -= amount [instruction] | Create a class in Python which models a bank account using the concept of class and object. [input] |

[output] | ^-?\d+(\.\d+)?$ [instruction] | Write a regex pattern to match a float number with at least one decimal place. [input] |

[output] | const pets = { cats: 10, dogs: 12 }; [instruction] | Create a Javascript object that stores the number of cats and dogs in a given location. [input] |

[output] | ul li:nth-child(2n+2) { // Styling } [instruction] | Write a CSS selector that selects every second list item. [input] |

[output] | <div class="progress-bar"> <div class="progress-bar-fill"></div> </div> <style> .progress-bar { width: 200px; height: 30px; background-color: #ccc; border-radius: 5px; box-shadow: inset 0 0 5px #ccc; } .progress-bar-fill { width: 0%; height: 30px; background- [instruction] | Create an animated loading bar using CSS. [input] |

[output] | let array = [1, "String", true, { key: "value" }, [1,2]]; [instruction] | Create an array in Javascript that contains elements of different datatypes. [input] |

[output] | void removeDuplicates(int arr[], int n) { // Return, if array is empty // or contains a single element if (n==0 || n==1) return; int temp[n]; // Start traversing elements int j = 0; for (int i=0; i<n-1; i++) { // If current element is not equal [instruction] | Write a C++ function to remove all the duplicates in a given array. [input] |

[output] | { "team": "Boston Celtics", "player": "Gordon Hayward", "contract": "Four-year deal", "recent_record": "teams worst record since 2007", "average_points": 10.7, "average_rebounds": 5 } [instruction] | Parse and save the following article in a dataset. [input] | "The Boston Celtics have signed forward Gordon Hayward to a four-year deal. Good move from the Celtics, who are coming off of a teams worst record since 2007? The 29-year-old Hayward has averaged 10.7 points and 5 rebounds per game in his eight-year career"

[output] | Deep learning can be used in healthcare to improve diagnosis accuracy, automate medical image analysis, predict risk of diseases, and improve treatments. For example, a deep learning model can be used to analyze CT scans to detect cancerous nodules or classify different types of mammograms. Addition [instruction] | Suggest a possible use case of deep learning in healthcare. [input] |

[output] | Reinforcement learning can be used in business to automate processes, optimize products and services, improve marketing campaigns, and develop better customer experiences. For example, a reinforcement learning model can learn the best way to stock products in a store and optimize product placement t [instruction] | Suggest a use case for reinforcement learning in business. [input] |

[output] | Natural language processing can be used in healthcare to analyze patient documents for insights, automate medical coding, detect drug interactions, identify risk factors and trends, and improve healthcare communication. For example, a natural language processing system can be used to scan patient no [instruction] | Suggest a use case for natural language processing in healthcare. [input] |

[output] | SELECT AVG(price) FROM products WHERE type = 'product_type' [instruction] | Write a SQL query to find the average price of the products in a given product type. [input] |

[output] | { "key1": 10, "key2": 20, "key3": 30 } [instruction] | Analyse a provided JSON object and change the value of a specific key to the sum of 2 other keys [input] | { "key1": 10, "key2": 20, "key3": 0 }

[output] | [9, 8, 6, 5, 3, 2] [instruction] | Rank a list of integer from high to low [input] | [2, 5, 8, 3, 9, 6]

[output] | #include <stdio.h> int main(void) { int a = 5; int b = 4; printf("%d + %d = %d\n", a, b, a+b); return 0; } [instruction] | Edit the following code to perform arithmetic operation [input] | #include <stdio.h> int main(void) { int a = 5; int b = 4; printf("%d", a); printf("%d", b); return 0; }

[output] | public class CommonChars { public static void main(String[] args) { String str1 = "abcde"; String str2 = "defgh"; //Loop through both strings for (int i = 0; i < str1.length(); i++) { char ch1 = str1.charAt(i); for (int j = 0; j < s [instruction] | Develop a Java program that takes two strings as input and outputs the common characters in both strings. [input] | String A: abcde String B: defgh

[output] | import numpy as np arr1 = np.array([1,5,8,9]) arr2 = np.array([2,3,4,6]) result = arr1 * arr2 print(f'Product of the two arrays: {result}') [instruction] | Develop a program in Python that takes two array elements as input and finds their product [input] | Array1: [1, 5, 8, 9] Array2: [2, 3, 4, 6]

[output] | #include <iostream> using namespace std; int main() { double grade; cout << "Enter your test score (0-100): "; cin >> grade; if (grade >= 90 && grade <= 100) { cout << "Grade: A"; } else if (grade >= 80 && grade <90) { cout << "Grade: B"; } [instruction] | Create a C++ program for grading system [input] |

[output] | public class FahrenheitToCelsius { // F to C conversion formula public static double fahrenheitToCelsius(double fahrenheit) { return ((fahrenheit - 32) * 5) / 9; } public static void main(String[] args) { double fahrenheit = 100; double celsius = [instruction] | Generate a class in java to convert Fahrenheit to Celsius [input] |

[output] | import Foundation func isTriangle(sideA: Int, sideB: Int, sideC: Int) -> Bool { let sides = [sideA, sideB, sideC].sorted() return sides[2] < sides[1] + sides[0] } // Usage print(isTriangle(sideA: 3, sideB: 4, sideC: 6) // Output: true print(isTriangle(sideA: 3, sideB: 9, sideC: 10) // O [instruction] | Develop a program in Swift to check if three sides form a valid triangle [input] |

[output] | #include <iostream> struct Node { int data; Node* next; }; // Utility function to create a linked list Node* createLinkedList(int arr[], int n) { Node* head = new Node(); Node* temp = head; for (int i = 0; i < n; i++) { Node* newNode = new Node(); newNode->data [instruction] | Write code to construct a linked list in C++. [input] | Node data: - 2 - 4 - 5 - 9

[output] | The main difference between a Java applet and a Java application is that an applet is a client-side application that is downloaded from server and is run in a web browser, while a Java application is a stand-alone program which runs directly on the included JVM. Applet code is able to access resourc [instruction] | What are the differences between a Java applet and a Java application? [input] |

[output] | public class PrintIntegers { public static void main(String[] args) { for(int i=30; i<=50; i++) { System.out.println(i); } } } [instruction] | Write a Java program that prints all integers between 30 & 50 (inclusive). [input] |

[output] | <html> <head> <style> body { font-size: 18px; } </style> </head> </html> [instruction] | Write HTML code to set the font size of a page to 18px. [input] |

[output] | SELECT name, population, area FROM countries ORDER BY population/area DESC LIMIT 10; [instruction] | Write a SQL query to select the top 10 countries ordered by population density. [input] | Table Name: countries Columns: name, population, area

[output] | [A-Za-z0-9] [instruction] | Create a regex pattern to identify alphanumeric characters. [input] |

[output] | .pinktext { color: pink; } [instruction] | Construct a CSS class to set the font color of a paragraph to pink. [input] |

[output] | public static int calculateTotalMarks(int marks_sub1, int marks_sub2, int marks_sub3, int marks_sub4, int marks_sub5) { return marks_sub1 + marks_sub2 + marks_sub3 + marks_sub4 + marks_sub5; } [instruction] | Write a Java method to calculate the total marks of a student given their marks of 5 subjects. [input] | int marks_sub1 = 80; int marks_sub2 = 90; int marks_sub3 = 85; int marks_sub4 = 92; int marks_sub5 = 87;

[output] | Node *secondLastElement(Node *head) { if (head == NULL || head->next == NULL) return NULL; Node *secondLast = head; while (secondLast->next->next != NULL) secondLast = secondLast->next; return secondLast; } [instruction] | Using the given linked list, find out the second last element. [input] | 1 -> 3 -> 5 -> 7 -> 9 -> 11

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