← 목록

Synth · CodeAlpaca일부

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

[output] | The design should include a navigation menu that allows users to search for and select food items, view the items in their cart, and checkout. The navigation menu should also have options to sign up, sign in, and view their order history that would only be visible when they are signed in. The checko [instruction] | Come up with a design for a simple GUI-based web application that allows users to order food online. [input] |

[output] | import json data = json.loads(input) highestScore = 0 highestName = "" for d in data: if d["score"] > highestScore: highestScore = d["score"] highestName = d["name"] print(highestName) [instruction] | Analyze the given JSON data and find the name of the user with the highest 'score' attribute. [input] | [ { “name”: “John”, “score”: 80 }, { “name”: “Jane”, “score”: 95 }, { “name”: “Tom”, “score”: 67 } ]

[output] | class Student { private string name; private int age; private double gpa; // Constructor public Student (string name, int age, double gpa) { this.name = name; this.age = age; this.gpa = gpa; } // Getter methods public string GetName() { return name; } pub [instruction] | Create a class that models a student with attributes such as name, age, and GPA. [input] |

[output] | def QASystem(paragraph): words = paragraph.split() answer = words[-1] while True: user_input = input('What is the first year of this century? ') if user_input == answer: print('Your answer is correct!') break else: print('Incor [instruction] | Write a Question answer system for the given paragraph. [input] | Paragraph: The current century is the 21st century and it started in 2001

[output] | def reverse_array(array): reversed_array = [] for elem in array: reversed_array.append(elem[::-1]) return reversed_array if __name__ == '__main__': print(reverse_array(array)) [instruction] | Write a code to reverse each element of an array [input] | array = ['apple','dog','cat','mouse','ball']

[output] | def is_present(array, element): if element in array: return True else: return False if __name__ == '__main__': print(is_present(array, element)) [instruction] | Write a code to check if an element is present in an array [input] | array = ['apple','dog','cat','mouse','ball'] element = 'cat'

[output] | class Matrix: def __init__(self, array): self.array = array self.rows = len(array) self.cols = len(array[0]) def get_matrix(self): return self.array def set_matrix(self, array): self.rows = len(array) self.cols = len(array[0]) sel [instruction] | Create a python class to represent a 3x3 matrix [input] |

[output] | def median(x,y,z,w): nums = [x,y,z,w] nums.sort() mid =len(nums)//2 if len(nums)%2 == 0: median = (nums[mid] + nums[mid-1])/2 else: median = nums[mid] return median if __name__ == '__main__': print(median(11,12,13,14)) [instruction] | Write a code to get the median of four numbers [input] | x = 11, y = 12, z = 13, w = 14

[output] | This is an example sentence? [instruction] | Modify a given sentence by replacing the invalid punctuation with a valid one. [input] | This is an example sentence.

[output] | hours = float(input("Input the hours: ")) rate = float(input("Input the rate: ")) tax_rate = float(input("Input the tax rate: ")) [instruction] | Translate the following sentence to Python code. [input] | Input the hours, rate and the tax rate.

[output] | SELECT COUNT(*) as num_books FROM `BOOK` WHERE availability = 1; [instruction] | Generate a SQL query to count the number of books that are available in the table BOOK. [input] |

[output] | result = 27 [instruction] | Create a new variable called result which is the sum of the variables a and b. [input] | a = 13 b = 14

[output] | 255 [instruction] | What is the maximum value that can be assigned to an unsigned 8-bit integer? [input] |

[output] | def get_name(data): return data["name"] [instruction] | Complete the following code so as to return the value of the key-value pair "name" in the given JSON object. [input] | data = { "name": "John", "age": 20 } def get_name(data): # Your code here

[output] | The total number of leaf nodes that will be left after deleting a node depends on the structure of the tree. If the deleted node is a leaf node, then the number of leaf nodes will be reduced by one. However, if the deleted node has children, then the number of leaf nodes may stay the same, or increa [instruction] | Suppose there are N nodes in a binary tree. After deleting a node, how many leaf nodes will be left? [input] |

[output] | def find_duplicates(arr): result = [] for i in range(0, len(arr)): for j in range(i + 1, len(arr)): if arr[i] == arr[j]: result.append(arr[i]) return result arr = [1, 4, 7, 2, 6, 1, 7, 2] result = find_duplicates(arr) print(result) [instruction] | Write an algorithm in Python that takes an array as input and prints all the duplicate values in it. [input] | arr = [1, 4, 7, 2, 6, 1, 7, 2]

[output] | The ternary operator can be used to compare two values in the following way: (condition) ? (value if condition is true) : (value if condition is false); [instruction] | How would you use the ternary operator for comparing two values in JavaScript? [input] |

[output] | SELECT customerId, SUM(totalprice) FROM transactions GROUP BY customerId; [instruction] | Write a SQL query to group a table by a certain value and sum up another numerical column. [input] | Table name: transactions Group by: customerId Sum value: totalprice

[output] | String[] arr = {"apple", "banana", "orange"}; [instruction] | Create an array of strings in Java with three elements - "apple", "banana" and "orange". [input] |

[output] | def OddEven(num): if num%2 == 0 : print("{} is Even".format(num)) else : print("{} is Odd".format(num)) OddEven(23) [instruction] | Write a function in Python that takes a number as input and prints out if the number is odd or even. [input] | Number = 23

[output] | int. [instruction] | What should be the return type of the following function in Java? [input] | public int add(int a, int b) { return a + b; }

[output] | SELECT SUBSTRING(accountNumber, 1, 2) FROM customerinfo; [instruction] | Write a SQL query to find the first two digits of an integer value in a column. [input] | Table name: customerinfo Column name: accountNumber

[output] | SELECT * FROM companies WHERE employees > 50; [instruction] | Write a SQL query to select all companies where the number of employees is greater than 50. [input] | Table name: companies Employee column: employees

[output] | The positions of all vowels in the string "mississippi" are: [1, 4, 7, 10]. [instruction] | Print the positions of all vowels in the given string. [input] | String: mississippi

[output] | The smallest positive number which is divisible by both 5 and 7 is 35. [instruction] | Find the smallest positive number which is divisible by both 5 and 7. [input] |

[output] | <html> <head> <script> for(let i=0; i<5; i++){ console.log('loop ' + i); } </script> </head> <body> </body> </html> [instruction] | Create an HTML page demonstrating the application of "for" loop in JavaScript [input] |

[output] | Exception handling is an important part of programming languages such as Java. It allows the programmer to handle errors gracefully without crashing the system, while also allowing the program to continue execution in a normal manner. By catching exceptions, a program can handle unexpected inputs or [instruction] | Explain the significance of exception handling in Java. [input] |

[output] | public class Employee { private String name; private int age; private String position; public Employee(String name, int age, String position) { this.name = name; this.age = age; this.position = position; } public String getName() { return nam [instruction] | Design a class in Java that creates an Employee record. [input] |

[output] | function sumTime(hrs, mins) { return (hrs * 60 + mins); } console.log(sumTime(2, 45)); # Output 165 [instruction] | Write a JavaScript function for summing up the number of hours and minutes. [input] | Hours: 2 Minutes: 45

[output] | Creative, Ambitious, Independent, Kind, Generous, Compassionate, Confident, Hardworking, Empathetic, Loyal. [instruction] | Come up with a list of 10 words that best describes a person [input] |

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