← 목록

Synth · CodeAlpaca일부

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

[output] | const findHighestValue = arr => { let highest = null; arr.forEach(num => { if (!highest || num > highest) { highest = num; } }); return highest; }; module.exports = findHighestValue; [instruction] | Create a Node.js module to return the highest value in an array [input] |

[output] | SELECT * FROM employee WHERE age > 25; [instruction] | Create a postgres query to select all rows from a table named 'employee' where the age is greater than 25 [input] |

[output] | # Take input from user numbers = input("Enter numbers: ") # split the string numbers = list(map(int, numbers.split(' '))) # Loop to print the squares of numbers for number in numbers: print(number*number) [instruction] | Write a python script that takes user input and prints out the squares of the numbers [input] |

[output] | name - John age - 35 job - teacher [instruction] | Extract the values of the keys of a given dictionary. [input] | Dictionary = {'name': 'John', 'age': 35, 'job': 'teacher'}

[output] | 4 [instruction] | Output the size of the below list. [input] | list_a = [1, 2, 3, 4]

[output] | list_2d = [[0 for i in range(m)] for j in range(n)] [instruction] | Create and fill a 2-dimensional list with the dimensions n and m. [input] | n = 3, m = 5

[output] | '128' [instruction] | Parse the following string to obtain all the digits. [input] | str1 = "Price of the product is $128."

[output] | list1 = [1,2,3] list2 = [4,5,6] [instruction] | Divide the list into two equal halves and output them. [input] | list_c = [1,2,3,4,5,6]

[output] | def foo(a, b): # This function adds two numbers and returns the sum c = a + b return c [instruction] | Annotate the given code with its function [input] | def foo(a, b): c = a + b return c

[output] | Dict = {key: value for key, value in {"A":1, "B":2, "C":3, "D":4}.items()} [instruction] | Create a dictionary comprehension for the given data. [input] | {"A":1, "B":2, "C":3, "D":4}

[output] | #Import relevant packages import pandas as pd import matplotlib.pyplot as plt #Create dataframe data = [[5.1, 3.5], [1.4, 2.3], [3.3, 4.3], [3.6, 2.7]] df = pd.DataFrame(data, columns = ['x','y']) #Create scatterplot plt.scatter(x=df["x"], y=df["y"]) #Name axes plt.xlabel('x') plt.ylabel('y' [instruction] | Generate a Jupyter notebook to display a scatterplot of a given dataset. [input] | Data: [[5.1, 3.5], [1.4, 2.3], [3.3, 4.3], [3.6, 2.7]]

[output] | i = 1 while(i <= 10): print(i) i += 1 [instruction] | Construct a while loop in Python to print all numbers less or equal to 10. [input] |

[output] | sentence.split(':') # Output: ['This', 'is', 'a', 'string'] [instruction] | Split a given string on the separator “:”. [input] | sentence = "This:is:a:string"

[output] | int[] arr = {2, 3, 5, 4, 2, 3}; Set<Integer> set = new HashSet<Integer>(); for (int i : arr) { set.add(i); } [instruction] | Create a set in Java from a given array of numbers. [input] | Array: [2, 3, 5, 4, 2, 3]

[output] | <!DOCTYPE html> <html> <head> <title>Create a basic HTML page</title> </head> <body> <h1>Hello, World!</h1> </body> </html> [instruction] | Create a basic HTML page with a <title> tag and a <h1> tag. [input] |

[output] | def iterate_dictionary(dict): for key in dict: print(key, ':', dict[key]) iterate_dictionary(dict) [instruction] | Write a function in Python to iterate over the items in a dictionary. [input] | dict = {'Apple':1, 'Orange':2, 'Mango':3}

[output] | <div style="background-color:blue;"></div> [instruction] | Create a div in HTML with a background color of 'blue'. [input] |

[output] | The maximum number of columns allowed in a MySQL table is 4096. [instruction] | What is the maximum number of columns allowed in a MySQL table? [input] |

[output] | p { font-weight: bold; font-style: italic; text-align: center; } [instruction] | Create a CSS style for a <p> tag to make it bold, italic and center-aligned. [input] |

[output] | UPDATE employees SET date = NOW() WHERE ID = <id>; [instruction] | Create a MySQL query to update the date in the 'date' column of the 'employees' table. [input] |

[output] | print(len(string)) 12 [instruction] | Given a string, write a code to print the length of the string. [input] | string = "Hello world!"

[output] | # return the two largest numbers in the array largestOne = max(numbers) numbers.remove(largestOne) largestTwo = max(numbers) print(largestOne, largestTwo) 10 9 [instruction] | Based on the following input array, return the largest two numbers in the array. [input] | numbers = [10, 9, 8, 7, 6, 5]

[output] | dictionary[key] = value [instruction] | Under the given dictionary, write a code to replace the value at a given key. [input] | dictionary = { 'name': 'David', 'age': 20 } key = 'name' value = 'Eddie'

[output] | hello world [instruction] | Change the capitalization of the a text string. [input] | Hello World

[output] | # print the length of array print(len(arr)) 5 # print the middle element of array midIndex = len(arr) // 2 print(arr[midIndex]) 3 [instruction] | Print the length and the middle element of the given array. [input] | arr = [1, 2, 3, 4, 5]

[output] | # set the sum to 0 sum = 0 # loop from 1 to 7 for i in range(1, num+1): # add each number to "sum" sum += i # print the sum print(sum) 28 [instruction] | Given an integer, calculate the sum of the numbers till that number. [input] | num = 7

[output] | if [ -z "$var" ]; then echo "The variable is empty." fi [instruction] | What is the proper way to check if a variable of type String is empty in Bash? [input] |

[output] | document.getElementById("message").setAttribute("data-text", "My Message"); [instruction] | Replace the following line of Javascript to appy the data-attribute to the element. [input] | document.getElementById("message").append("My Message");

[output] | <div id="message" class="my-class">Hello World!</div> [instruction] | How could you modify the following HTML to include a class attribute? [input] | <div id="message">Hello World!</div>

[output] | # Print numbers from 0 to 9 for x in range(10): print(x) # Print numbers from 3 to 8 for x in range(3, 9): print(x) # Print numbers from 3 to 8 incrementing by 2 for x in range(3, 9, 2): print(x) [instruction] | Provide an example of using Python's range() function to generate a range of numbers. [input] |

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