← 목록

Synth · CodeAlpaca일부

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

[output] | df -h /mount/point [instruction] | Create a Linux shell command to find out the total disk space available in a given mount point [input] |

[output] | tf.constant([[1., 2.], [3., 4.], [5., 6.]]) [instruction] | Create a TensorFlow tensor with the following data [input] | [[1, 2], [3, 4], [5, 6]]

[output] | def iterateMyList(myList): iterator = iter(myList) while True: try: print(next(iterator)) except StopIteration: break [instruction] | Write an iterator in Python to iterate through the given list and output each element [input] | myList = ['Hi', 'Bye', 'Hello', 'World']

[output] | def printCurrentLocalTime(): currentLocalTime = datetime.datetime.now() print(currentLocalTime.strftime("%c")) [instruction] | Create a function to print the current local time. [input] |

[output] | import numpy as np X = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) y = np.array([1, 0, -1]) [instruction] | Create some sample data to test a supervised learning algorithm. [input] |

[output] | hello world. This is from GPT [instruction] | Given a text string modify it by capitalizing the letters after a period. [input] | hello world. this is from gpt

[output] | <html> <body> <table> <tr> <th>Student Name</th> <th>Class</th> <th>Age</th> </tr> <tr> <td>John</td> <td>8th</td> <td>14</td> </tr> <tr> <td>Ann</td> <td>9th</td> <td>15</td> </tr> <tr> <td>James</td> <td>10th</td> <td>16</td> </tr> </table> </body> </html> [instruction] | Create a HTML page with a table which contains data about the student population. [input] |

[output] | namaskāra vasudeva [instruction] | Convert this string to a Sanskrit translation. [input] | Hello world

[output] | import re import requests urls = set() def get_urls(url): website = requests.get(url) content = website.text links = re.findall(r'<a .*?href=[\'"](.*?)[\'"].*?>', content) for i in links: if i.startswith("/"): base_url = url i = base_url + i [instruction] | Implement a web scraper in Python to fetch all the URLs from a given website. [input] | The website URL is https://www.example.com

[output] | ^(?:(((?!([0-4]?[0-9]|50)|)|50)|[1-4]?[0-9])$ [instruction] | Generate a series of natural numbers from 1 to 50 using regex [input] |

[output] | [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] [instruction] | Create an array of integers that contain all the prime numbers between 1 and 50 [input] |

[output] | SELECT * FROM people WHERE age BETWEEN 18 AND 25; [instruction] | Write a SQL query to select all the people between the ages of 18 and 25 [input] |

[output] | # Define a StateMachine class class StateMachine: def __init__(self): self.handlers = {} self.startState = None self.endStates = [] def add_state(self, state): self.handlers[state.name] = state def set_start(self, name): self.startState [instruction] | Build a state machine in Python to process incoming keyboard events [input] |

[output] | json_string = json.dumps(data) [instruction] | Convert this Python data structure into a valid JSON string. [input] | data = { "key1" : [1,2,3], "key2" : { 'subkey1' : True, 'subkey2' : 'Hello World' } }

[output] | name and age. [instruction] | Figure out which column's information is being displayed in this SQL query. [input] | SELECT name, age FROM students WHERE id = 8

[output] | This statement is trying to process a numerical data type. [instruction] | What type of data is this PHP statement trying to process? [input] | $number = intval($input_value);

[output] | SELECT * FROM student WHERE GPA = 4.0::float8; [instruction] | Convert this SQL query into a valid Postgres statement. [input] | SELECT * FROM student WHERE GPA = 4.0

[output] | This HTML code snippet creates a div with the id "test" and displays the text "Hello World!" within it. [instruction] | Read this HTML code and explain in a few words what this snippet does. [input] | <div id="test">Hello World!</div>

[output] | <form> Name: <input type="text" name="name" required> Age: <input type="number" name="age" required> Email: <input type="email" name="email" required> </form> [instruction] | You need to create a web form with 3 input fields: Name, Age, and Email. [input] |

[output] | bool isDivisibleByFive(int number) { return number % 5 == 0; } [instruction] | What is the C# code to check if a number is divisible by 5? [input] |

[output] | list_comprehension = [x*2 for x in [1,2,3,4]] print(list_comprehension) [instruction] | Create a list comprehension that multiplies each item in a list by 2. [input] | [1,2,3,4]

[output] | def largest(a, b): """Returns the larger number from two numbers provided.""" if a > b: return a else: return b num1 = 4 num2 = 5 print(largest(num1, num2)) [instruction] | Write a function that returns the larger number from two numbers provided. [input] | 4, 5

[output] | def create2DArray(n, m): array = [[0 for x in range(m)] for y in range(n)] return array print(create2DArray(3, 5)) # prints [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] [instruction] | Write a code that returns a 2-dimensional array of size n by m containing all 0s [input] | n = 3 and m = 5

[output] | def alphabetically_sort_words(str): words = str.split(' ') words.sort() return words print(alphabetically_sort_words("Here is a sentence to sort")) # prints ['Here', 'a', 'is', 'sentence', 'sort', 'to'] [instruction] | Write a function that takes in a string and returns a list of all words in the string in alphabetical order [input] | str = "Here is a sentence to sort"

[output] | result = [] for s in list: if s == s[::-1]: result.append(s) print(result) #['abb'] [instruction] | When given a list of strings, identify which strings are palindromes [input] | list = ['abc', 'abb', 'cba']

[output] | def combinations(n, k): if k == 0 or k > n: return [] result = [] def dfs(start,n,k): if k == 0: result.append(temp[:]) return for i in range(start, n): temp.append(i) dfs(i+1, n, k-1) temp.pop() [instruction] | Generate a program to calculate the combination of n elements taken k at a time. [input] | n = 8 k = 3

[output] | def join_nums_symbols(nums, symbols): assert len(nums) == len(symbols), "length of nums and symbols should be equal" result = "" for i in range(len(nums)): result += str(nums[i]) + symbols[i] return result [instruction] | Modify the function such that it takes two arrays, one containing numbers and the other containing symbols as arguments and returns a string where each number is replaced with its associated symbol. [input] | nums = [1,2,3,4,5] symbols = ["A","B","C","D","E"]

[output] | def rearrange_array(arr): output = [] for i in range(len(arr)): idx = (i + 1) % len(arr) output.append(arr[idx]) return output [instruction] | Generate a function that takes an array of integers and rearranges the elements in a cyclical fashion, such that the element at index 0 comes last, the element at index 1 goes to the front, the element at index 2 is inserted after the element at the last index and so on. [input] | arr = [1, 2, 3, 4, 5]

[output] | def split_string(string, delimiter): strList = string.split(delimiter) return strList [instruction] | Create a Python function and call it split_string that takes a string and a delimiter as arguments and returns a list containing the string split by the delimiter. [input] | my_string = "hello, world" delimiter = ','

[output] | def get_last_two(arr): return arr[-2:] [instruction] | Create a program that prints the last two elements of a list. [input] | arr = [1,2,3,4,5,6,7]

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