[output] | The command to run a Python script from the command line is `python filename.py`. [instruction] | What is the command to run a Python script from the command line? [input] |
[output] | <html> <head></head> <body> <input type="text" id="textbox"> <button onclick="sayHello()">Say Hello</button> <p id="message">Hello World!</p> <script> function sayHello() { var text = document.getElementById('textbox').valu [instruction] | Create a HTML page with a textbox, button and a message “Hello World!” [input] |
[output] | #content { margin: 0 auto; width: 70%; text-align: center; } [instruction] | Write a CSS rule to center align a div element with id="content" [input] |
[output] | Get-ItemPropertyHKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | select-Object DisplayName, Publisher [instruction] | Write a PowerShell script to list all the installed applications on a Windows machine [input] |
[output] | The MySQL command to drop a database named 'test' is `DROP DATABASE test;`. [instruction] | What is the MySQL command to drop a database named 'test' [input] |
[output] | const prime_nums = () => { let count = 0; let num = 2; while(count < 5) { if(isPrime(num)) { console.log(num); count++; } num++; } } function isPrime(n) { for(let i = 2; i < n; i++) if(n % i === 0) return false; return [instruction] | Create a Node.js program to print the first 5 prime numbers [input] |
[output] | a = list(map(int, input("Enter 10 numbers: ").split())) [instruction] | Write a line of code to input 10 numbers from the user. [input] |
[output] | def compare_strings(string_1, string_2): similarity_score = 0 n = min(len(string_1), len(string_2)) for i in range(n): if string_1[i] == string_2[i]: similarity_score += 1 return similarity_score [instruction] | Create a function to compare two strings and output their similarity score. [input] | string_1 = "python" string_2 = "coding"
[output] | def count_list_elements(list_numbers): count = 0 for element in list_numbers: count += 1 return count [instruction] | Output the total number of elements in a given list. [input] | list_numbers = [1, 2, 3, 4, 5]
[output] | def search_list(list_numbers, element): for i in range(len(list_numbers)): if list_numbers[i] == element: return i [instruction] | Create a function to search for a given element in a list and output its index. [input] | list_numbers = [1, 2, 3, 4, 5]
[output] | npm install ejs [instruction] | Write a command to install a package in Node.js from the Node Package Manager. [input] | Package name: ejs
[output] | <p> This is the first sentence. This is the second sentence. This is the third sentence. This is the fourth sentence. This is the fifth sentence. </p> [instruction] | Create an HTML element for a paragraph and add five sentences to it. [input] |
[output] | public static int RoundToNearestInteger(double number) { return (int)Math.Round(number, 0); } RoundToNearestInteger(27.7); //output: 28 [instruction] | Write a function in C# to round a given number to the next closest integer. [input] | Number: 27.7
[output] | int number = 9; if (number >= 15) { System.out.println("Number is greater than or equal to 15"); } else { System.out.println("Number is less than 15"); } [instruction] | Write an if-else statement in Java to check if a given number is greater than or equal to 15. [input] | Number: 9
[output] | pattern = r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,63}$" [instruction] | Construct a regular expression pattern in Python that matches all emails. [input] |
[output] | import React from 'react'; class AlertButton extends React.Component { onClick() { alert('Button clicked!'); } render() { return ( <button onClick={this.onClick}>Click me</button> ); } } [instruction] | Create a React component that displays an alert when a button is clicked. [input] |
[output] | date +"%d-%m-%Y" [instruction] | Write a Bash command that outputs the system's date as "DD-MM-YYYY". [input] |
[output] | class Vehicle { let modelName: String let year: Int init(modelName: String, year: Int) { self.modelName = modelName self.year = year } } [instruction] | Create a Swift class called "Vehicle" that includes two properties: a model name (String) and a year (Int). [input] |
[output] | func len(s []int) int { return len(s) } [instruction] | Write a function in Go language that will return the number of elements in a slice. [input] |
[output] | public static synchronized void incrementCounter(int counter) { counter += 1; } [instruction] | Create a thread-safe Java method that increments a given counter. [input] |
[output] | class Math { add(n1: number, n2: number): number { return n1 + n2; } } [instruction] | Create a class in TypeScript that contains a method that takes two numbers, adds them, and returns the result. [input] |
[output] | <form action=""> <label>Name:</label> <input type="text" name="name"> <label>Email Address:</label> <input type="email" name="email"> </form> [instruction] | Construct an HTML form that includes two input fields, one for a name and one for an email address. [input] |
[output] | function mostFrequentElem(arr) { let countMap = new Map(); for (let i = 0; i < arr.length; i++) { if (!countMap.has(arr[i])) { countMap.set(arr[i], 1); } else { let val = countMap.get(arr[i]); countMap.set(arr[i], val + 1); } } let maxCount = 1; let maxElem; [instruction] | Design an algorithm in JavaScript that finds the most frequent element in an array. [input] |
[output] | SELECT * FROM students ORDER BY id DESC LIMIT 4; [instruction] | Write a SQL query to retrieve the last four entries of a table called "students". [input] |
[output] | task :update_time do system("date +%T -s '#{Time.now.strftime("%H:%M:%S")}'") end [instruction] | Create a rake task in Ruby that updates the system time. [input] |
[output] | [10, 20, 30] [instruction] | Write a command to retrieve the first n items from a list. [input] | [10, 20, 30, 40, 50], n = 3
[output] | { "firstname": "John", "lastname": "Doe", "age": 25 } [instruction] | Create a JSON object with the following elements: firstname, lastname, age [input] |
[output] | mylist.sort() [instruction] | Edit this code to sort a list of strings alphabetically [input] | mylist = ["Eggs", "Cheese", "Milk"]
[output] | <html> <head> <title>Welcome to my website!</title> </head> <body> <h1>Welcome to my website!</h1> </body> </html> [instruction] | Create a HTML page that prints the following message [input] | "Welcome to my website!"
[output] | SELECT * FROM customers WHERE country = 'US'; [instruction] | Write an SQL query to select all the customers who are from the US. [input] |