← 목록

Synth · CodeAlpaca일부

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

[output] | /^cat\w+/ [instruction] | Construct a regex expression to capture words starting with 'cat' [input] |

[output] | <!Doctype html> <html> <head> <title>My Website</title> </head> <body> <h1>Welcome to My Website!</h1> <p>Content goes here.</p> </body> </html> [instruction] | Generate a HTML layout to make a basic website page. [input] |

[output] | input[type=text] { width: 250px; } [instruction] | Compose a CSS code to display a textbox with a width of 250px [input] |

[output] | <!DOCTYPE html> <html> <head> <title>User Info</title> <style> tr, td { border: 1px solid black; padding: 5px; } </style> </head> <body> <table> <tr> <td>Name</td> <td>Phone Number</td> <td>Email</td> </tr> < [instruction] | Using HTML and CSS, create a page to display a list of users with their contact information [input] |

[output] | def get_products(arr): left = [1] right = [1] ans = [] # Traverse from left to right for i in range(1, len(arr)): left.append(arr[i-1] * left[i-1]) # Traverse from right to left for i in reversed(range(len(arr)-1)): right.insert(0, arr[i+1] * right[0]) [instruction] | Write a function that takes an array of numbers and returns an array whose elements are the product of all the elements except the element at the current index. [input] | arr = [2, 3, 4, 5]

[output] | function splitAndSwitch(str) { let mid = Math.floor(str.length / 2); let firstHalf = str.substr(0, mid); let secondHalf = str.substr(mid); return secondHalf + firstHalf; } console.log(splitAndSwitch(str)); // returns "World!Hello" [instruction] | You are given a string and you need to write a function that splits the string at the mid point and switch the order of the two parts. [input] | str = "Hello World!"

[output] | filename = "input.txt" ext = filename.split('.')[-1] print(ext) #output: 'txt' [instruction] | Extract the extension from a given filename string. [input] | filename = "input.txt"

[output] | var arr = [1,2,3,4,5,6]; console.log(arr.length); #output: 6 [instruction] | What is the length of the array in this JavaScript line of code? [input] | var arr = [1,2,3,4,5,6];

[output] | numbers = [2, 3, 4, 7] total = 0 for n in numbers: total += n print(total) #output: 2 5 9 16 [instruction] | Print the running total of numbers in the following list. [input] | numbers = [2, 3, 4, 7]

[output] | In Python, there are two types of loops - for loop and while loop. A for loop is used to iterate over a sequence (list, tuple, string). A while loop is used to iterate until a condition is met. [instruction] | List the type of loops in Python. [input] |

[output] | sentence = "I am a coder" words = sentence.split(' ') third_word = words[2] print(third_word) #output: 'a' [instruction] | Given a sentence, write the code to extract the third word from the sentence. [input] | sentence = "I am a coder"

[output] | my_dict = { "a": 10, "b": 5, "c": 15 } sorted_dict = {k: v for k, v in sorted(my_dict.items(), key=lambda item: item[1])} print(sorted_dict) #output: {"b": 5, "a": 10, "c": 15} [instruction] | Write the code to sort a dictionary by values in Python. [input] | my_dict = { "a": 10, "b": 5, "c": 15 }

[output] | sum = 0 for num in [4,6,5,8]: sum = sum + num print("The sum is:",sum) [instruction] | Use a for loop to sum the numbers in the list [4, 6, 5, 8]. [input] |

[output] | my_dict = { "ant": "animals", "cat": "pets" } [instruction] | Modify the given dictionary such that any keys that start with the letter 'b' are removed. [input] | my_dict = { "ant": "animals", "ball": "toy", "cat": "pets" }

[output] | CREATE TABLE Items ( id INT NOT NULL, name VARCHAR(255) NOT NULL, price INT NOT NULL ); [instruction] | Write a MySQL query to create a table named 'Items' with 3 fields: 'id', 'name', and 'price'. [input] |

[output] | sum = 0 for row in arr: for el in row: sum += el print("The sum of elements in the array is:",sum) [instruction] | Given an array of numbers, provide a nested for loop to calculate the sum of elements in the array. [input] |

[output] | import tensorflow as tf # Create a model model = tf.keras.models.Sequential([ # Add a convolutional layer with a 3x3 window tf.keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=(28, 28, 1)), # Add a Max Pooling layer tf.keras.layers.MaxPooling2D((2, 2)), # Add a Fla [instruction] | Use TensorFlow to create a convolutional neural network to classify handwritten digits. [input] |

[output] | for x in range(1, 11): for y in range(1, 11): print(x, 'x', y, '=', x*y) [instruction] | Write a loop in Python to create a multiplication table. [input] |

[output] | arr = [1, 2, 3, 4, 5, 6] # delete the element at index 4 del arr[4] # print the array print(arr) [instruction] | Delete the element from the given array at index 4. [input] | arr = [1, 2, 3, 4, 5, 6]

[output] | def prime_numbers(n): primes = [] for num in range(2, n+1): is_prime = True for i in range(2, num): if (num % i == 0): is_prime = False if is_prime: primes.append(num) return primes [instruction] | Develop a program that prints all the prime numbers between 0 and n. [input] |

[output] | void swap(int& x, int& y) { int temp = x; x = y; y = temp; } [instruction] | Develop a C++ code snippet to swap two variables. [input] |

[output] | a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [instruction] | Rewrite following C code into Python code [input] | int a[10] = {0,1,2,3,4,5,6,7,8,9};

[output] | import numpy as np arr = np.array([[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]) [instruction] | Generate code to create a Numpy array with 3 rows and 4 columns. [input] |

[output] | import sys if __name__ == '__main__': args = sys.argv if len(args) > 1: command = args[1] print(f'Executing command: {command}') os.system(command) [instruction] | Create a program to execute a given command-line argument. [input] |

[output] | <html> <head> <title>Student Info Form</title> </head> <body> <form action="/submit" method="POST"> <label>Name:</label><br> <input type="text" name="name"><br><br> <label>Age:</label><br> <input type="number" [instruction] | Design an HTML form to enter student name, age, and course. [input] |

[output] | def reverse_string(my_string): return my_string[::-1] [instruction] | Create a function in Python which takes a string and reverses it. [input] |

[output] | The result of XORing 1010 and 0101 is 1111. [instruction] | Calculate the result of XORing two binary numbers. [input] | 1010, 0101

[output] | for (int i = 1; i <= 5; i = i-2){ // Code to be executed } [instruction] | Construct a for loop in Java using the following parameters: Initial value of i set to one, condition as i is less than or equal to 5, and iteration of i as subtraction of two. [input] |

[output] | userInput = 0 while userInput != 5: userInput = int(input('Enter a number: ')) [instruction] | Construct a while loop in Python which runs until user input is equal to 5. [input] |

[output] | SELECT name, department FROM Employees WHERE age > 35; [instruction] | Write a SQL query to select all the names and department of employees whose age is over 35. [input] |

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