← 목록

Synth · CodeAlpaca일부

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

[output] | <!DOCTYPE html> <html> <head> <title>John Doe's Contact Information</title> </head> <body> <h2>John Doe</h2> <p>Age: 46</p> <p>Phone: +1 (312) 555-4879</p> <p>Email: john.doe@example.com</p> </body> </html> [instruction] | Write an HTML page from scratch to display a user's contact information. [input] | name: John Doe; age: 46; phone: +1 (312) 555-4879; email: john.doe@example.com;

[output] | class LibraryBook { private String title; private String author; private int pageCount; private boolean available; public LibraryBook(String title, String author, int pageCount, boolean available) { this.title = title; this.author = author; this.pageCount = pageCount; [instruction] | Design an object-oriented program to represent a library book. [input] |

[output] | .box { width: 25px; height: 25px; background-color: red; border: 1px solid black; } [instruction] | Write a CSS code to display a red box with a black outline of size 25 x 25. [input] |

[output] | import numpy as np from tensorflow.keras.utils import to_categorical # Create a 3-layer neural network model = tf.keras.Sequential() model.add(tf.keras.layers.Dense(10, input_dim=784, activation='relu')) model.add(tf.keras.layers.Dense(50, activation='relu')) model.add(tf.keras.layers.Dense(10, act [instruction] | Construct an artificial neural network of 3-layers to classify handwritten digits. [input] |

[output] | import numpy as np arr = np.zeros((3, 3, 3)) print(arr) [instruction] | Create a 3D array of size 3 x 3 x 3 which contains all elements equal to 0. [input] |

[output] | def min_index(list): min_val = list[0] min_index = 0 for i, val in enumerate(list): if val < min_val: min_val = val min_index = i return min_index [instruction] | Given a list of numbers, write a function that returns the index of minimum element. [input] | [22, 11, 13, 66]

[output] | def double_list(nums): return [num * 2 for num in nums] [instruction] | Given a list of numbers, return the list with each number multiplied by two. [input] | [2, 4, 6, 8]

[output] | import random def shuffle_list(lst): for i in range(len(lst)-1, 0, -1): j = random.randint(0, i) lst[i], lst[j] = lst[j], lst[i] return lst [instruction] | Construct a program to shuffle the content of a list. [input] |

[output] | 4 [instruction] | Find the element in a list that occurs most frequently. [input] | [1, 1, 2, 3, 4, 5, 4, 4, 6, 5]

[output] | class Queue: def __init__(self): self.queue = [] def enqueue(self, data): self.queue.append(data) def dequeue(self): return self.queue.pop(0) def is_empty(self): return len(self.queue) == 0 [instruction] | Create a program that implements a queue. [input] |

[output] | def add_vectors(v1, v2): result = [] for i in range(len(v1)): result.append(v1[i] + v2[i]) return result print(add_vectors([3, 4], [5, 6])) [instruction] | Write a function to perform vector addition for two 1D arrays. [input] | [3, 4], [5, 6]

[output] | def min_num(n1, n2): if n1 < n2: return n1 else: return n2 print(min_num(7, 4)) [instruction] | Read two numbers and output the smallest one. [input] | 7, 4

[output] | import numpy as np array = np.random.randint(0, 6, size=(3,4)) print(array) Output: [[4 5 4 0] [2 1 5 4] [3 0 2 0]] [instruction] | Create a 3x4 NumPy array of random integers from 0 to 5. [input] |

[output] | const randomString = () => { let randomText = ''; const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; for (let i = 0; i < 20; i++) { randomText += possible.charAt(Math.floor(Math.random() * possible.length)); } return randomText; } console.log(randomString()); Outp [instruction] | Generate a random alphanumeric string of length 20 using JavaScript. [input] |

[output] | The position argument of the re.sub() method allows you to specify the starting index of the replacement string in the string being processed. This argument can be used to control the placement of a substitution in a string that may contain multiple occurrences of a pattern. If a position is not spe [instruction] | What does the position argument of the re.sub() method do? [input] |

[output] | function bubbleSort(str) { let arr = str.split(''); let sorted = false; while (!sorted) { sorted = true; for (let i = 0; i < arr.length; i++) { if (arr[i] > arr[i + 1]) { let temp = arr[i]; arr[i] = arr[i + 1]; [instruction] | Create a function in JavaScript that takes in a string and performs a bubble sort on it and returns the sorted string. [input] | string = "hello world"

[output] | class Greeting def initialize(phrase) @phrase = phrase end def say_hello @phrase end end greeting = Greeting.new("Hello, World!") puts greeting.say_hello [instruction] | Code a Ruby class that returns a phrase defined in its constructor when called. [input] |

[output] | echo "${Sentence}" | awk '{for (i=1;i<=NF;i++) print substr($i,1,1)}' [instruction] | Write a Bash shell command to extract the first character of each word in the given sentence. [input] | Sentence = "This is a test sentence"

[output] | <?php function returnKCharacters($s, $k) { return substr($s, 0, $k); } echo returnKCharacters("SoftwareTestingHelp", 6); ?> [instruction] | Implement a function in PHP that takes in a string s and an integer k as parameters and returns the first k characters of s. [input] | String = "SoftwareTestingHelp" Integer = 6

[output] | SELECT * FROM ages WHERE age BETWEEN 30 AND 40; [instruction] | Develop a SQL query to select numbers between 30 and 40 from a table column called 'ages'. [input] |

[output] | get_array_length = function(arr){ return length(arr) } [instruction] | Code an R function that takes an array arr as an argument and returns the length of the array. [input] | arr = c(4, 8, 15, 16, 23, 42)

[output] | .data arr BYTE 7, 3, 5, 8, 2 aux BYTE 5 DUP (0) .code mov esi, 0 ; index of original array mov edi, 0 ; index of aux array mov ecx, 5 ; array length sort_loop: mov al, [arr+esi] cmp al, [arr+esi+1] jl swap inc esi jmp increment swap: mov [aux+edi], al mov bl, [arr [instruction] | Create an assembly language program to sort a given array. [input] | arr = [7, 3, 5, 8, 2]

[output] | $str = "SoftwareTestingHelp"; print substr($str, 8, 1); [instruction] | Write a Perl script to output the 8th character in a given string. [input] | String = "SoftwareTestingHelp"

[output] | def collapse_whitespace(str): return ' '.join([x for x in str.split(' ') if x != '']) [instruction] | Develop a function to replace all consecutive whitespaces in a given string with a single space. [input] |

[output] | def isValidPhoneNumber(s): # strip all the non-numeric characters nums = ''.join(filter(str.isalnum, s)) # ensure it is 10 digits long if len(nums) != 10: return False # ensure the last 7 digits are valid if nums[3:10] in set('2', '3', '4', '5', '6', '7', '8 [instruction] | Create a function to determine if a String contains a valid US phone number [input] |

[output] | SELECT e1.name FROM Employee e1 JOIN Employee e2 ON e1.manager_id = e2.id WHERE e1.salary > e2.salary [instruction] | Write a SQL query that returns the names of people who have a higher salary than their manager [input] |

[output] | def extract_key_value_pairs(json_string): data = json.loads(json_string) key_value_pairs = {} for key,value in data.items(): key_value_pairs[key] = value return key_value_pairs [instruction] | Generate a code to extract the key-value pairs from a JSON string [input] |

[output] | #returns the index of the target, if it is found def binary_search(arr,left,right,target): # Check base case if right >= left: mid = left + (right - left) // 2 # If element is present at the middle itself if arr[mid] == target: return mid [instruction] | Create a function to perform recursive binary search in a sorted array [input] |

[output] | x = 2020 y = 1 print(x + y + 1) [instruction] | Edit the provided code so that the output is 2021. [input] | x = 2020 y = 1 print(x + y)

[output] | CREATE TABLE employers ( id INTEGER PRIMARY KEY, name VARCHAR(100) UNIQUE NOT NULL, age INT NOT NULL, gender VARCHAR(50) NOT NULL, street_address VARCHAR(100) NOT NULL, city VARCHAR(100) NOT NULL, state VARCHAR(100) NOT NULL, zip_code INT NOT NULL, phone_number VARCHAR(25) UNIQUE N [instruction] | Create a table in SQL to store details about 1000 employers. [input] |

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