[output] | def currency_convert(amount): #Convert amount from USD to INR inr = amount * 73.20 #return the converted currency return inr #Test amount = int(input("Enter amount of currency in USD:")) print("The amount in INR:",currency_convert(amount)) [instruction] | Construct a function to convert currency amount from USD to INR. [input] | Current USD to INR ratio: 1 USD = 73.20 INR
[output] | SELECT First_Name FROM Employees WHERE First_Name LIKE 'J%'; [instruction] | Construct a SQL query to find all first names from the table "Employees" beginning with "J". [input] | Table: Employees Column: First_Name
[output] | def reverse_string(s): return s[::-1] [instruction] | Update the given Python program to reverse a string. [input] | def reverse_string(s): #insert code here return s
[output] | def anagram_check(s1, s2): s1 = s1.replace(' ','').lower() s2 = s2.replace(' ','').lower() if(sort(s1) == sort(s2)): return True return False def sort(s): return sorted(s) [instruction] | Construct a function to check for an anagram in Python. [input] |
[output] | # Defining a node Node <- function(value){ this$value <- value this$next <- NULL return(this) } # Defining a Linked List LinkedList <- function(){ this$head <- NULL this$tail <- NULL # Function to add an element in the linked list addNode <- function(value){ n [instruction] | Develop an R program that returns the node of a linked list. [input] |
[output] | public class MatrixMultiplication { static int N = 5; static int[][] multiply(int[][] A, int[][] B) { int[][] C = new int[N][N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { [instruction] | Implement a matrix multiplication program in Java. [input] |
[output] | # Importing the libraries from keras.models import Sequential from keras.layers import Conv2D from keras.layers import MaxPooling2D from keras.layers import Flatten from keras.layers import Dense # Initialising the CNN classifier = Sequential() # Step 1 - Convolution classifier.add(Conv2D(32, (3, [instruction] | Build a CNN model in Keras to detect cancer from a provided dataset. [input] |
[output] | #function to return maximum max <- function(x) { max_num <- 0 #Initialize maximum number for (i in x) { if (i > max_num) { max_num <- i } } return (max_num) } #Test list <- c(10, 30, 20, 5, 100) maximum <- max(list) print(maximum) [instruction] | Develop a code in R that returns the maximum from a list. [input] |
[output] | SELECT name, job_title, salary FROM employees WHERE department = 'Sales' [instruction] | Create a SQL query to select the name, job title and salary of all employees who work in the Sales department. [input] |
[output] | """ Example of a deep learning neural network in Keras """ import keras from keras.models import Sequential from keras.layers import Dense #Create a Sequential model model = Sequential() #Add a Dense layer with 32 neurons and an input shape of 10 model.add(Dense(32, activation='relu', input_shape [instruction] | Create an example of a deep learning neural network in Keras. [input] |
[output] | """ The first line of code defines a function named `fun` which takes a single parameter `x`. The second line multiplies the parameter `x` by 2 and assigns the resulting value to a new variable called `y`. The third line returns the value stored in `y` as the output of the function. """ [instruction] | Explain the purpose of each line of code in the following program. [input] | """ def fun(x): y = x * 2 return y """
[output] | """ Example of data visualization using Python's matplotlib library """ import matplotlib.pyplot as plt #Create two datasets x_values = [1, 2, 3, 4, 5] y_values = [1, 4, 9, 16, 25] #Plot the data plt.plot(x_values, y_values) #Label the axes plt.xlabel('x values') plt.ylabel('y values') #Show t [instruction] | Create an example of data visualization using Python's matplotlib library. [input] |
[output] | ``` function createArray(size, character) { let arr = []; for (let i = 0; i < size; i++) { arr[i] = character; } return arr; }; ``` [instruction] | Write a JavaScript function to create an array with given size and filled with the characters given in second argument. [input] | 3, "*"
[output] | This line of code will sort the array `arr` in descending order. That is, the array's elements will be arranged in a descending order, with the highest element at the first index, the second highest at the second index, and so on. [instruction] | explain the meaning of the following line of code in terms a novice programmer can understand. [input] | arr.sort(reverse=True)
[output] | There are several types of sorting algorithms which can be used to sort a list of items. The most common ones are Bubble Sort, Insertion Sort, Selection Sort, Quick Sort, Merge Sort and Heap Sort. Bubble Sort works by repeatedly swapping adjacent elements if they are in the wrong order. Insertion [instruction] | Explain different types of sorting algorithms in brief. [input] |
[output] | ``` import re #Function to validate an email def is_valid_email(email): regex = '^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$' if (re.search(regex, email)): return True else: return False #Test the function if(is_valid_email("abc@gmail.com")): print("Valid E [instruction] | Create a code to validate an email address using Regular Expressions. [input] |
[output] | DELETE FROM users WHERE name="John"; [instruction] | Create a MySQL query to delete all the entries with the name "John" in the table "users". [input] |
[output] | ``` #For numbers from 1 through 100 for i from 1 to 100: #If the number is divisible by both 3 and 5 if i is divisible by 3 and 5: #Print FizzBuzz print "FizzBuzz" #If the number is divisible only by 3 elif i is divisible by 3: #Print Fizz print "Fizz" [instruction] | Create a pseudocode to solve the FizzBuzz problem. [input] |
[output] | Java [instruction] | Name the coding language used for developing native apps for Android. [input] |
[output] | y = 3*x + 4; [instruction] | Represent the function y = 3x + 4 in JavaScript. [input] |
[output] | /^[A-Za-z][A-Za-z0-9]{7,}$/ [instruction] | Solve this regular expression problem. [input] | A string should start with a letter, contain only letters and numbers, and should be at least 8 characters in length.
[output] | <html> <head> <title>Example page</title> <link href="style.css" rel="stylesheet"> </head> <body> </body> </html> [instruction] | Edit this HTML code to add a link element in the head of the page. [input] | <html> <head> <title>Example page</title> </head> <body> </body> </html>
[output] | <form action=""> <label>Country:</label> <select id="country"> <option value="">-- Select Country --</option> <option value="us">USA</option> <option value="uk">UK</option> </select> <label>City:</label> <select id="city"> <option value="">-- Select City --</option> <op [instruction] | Create an HTML form with two dropdowns to select from different countries and cities. [input] |
[output] | Class NewClass (Base): def __init__(self): super().__init__() [instruction] | Create a new class in Python that extends the existing class named 'Base'. [input] |
[output] | public class Employee { String name; int age; String phoneNumber; String address; public Employee(String name, int age, String phoneNumber, String address) { this.name = name; this.age = age; this.phoneNumber = phoneNumber; this.address = address; } // Getter [instruction] | In Java, construct a data structure for storing employee information, including name, age, phone number, and address. [input] |
[output] | String[] words = input.split("\\s"); String reversedString = ""; for (int i = words.length - 1; i >= 0; i--) { reversedString += words[i] + " "; } System.out.println(reversedString); [instruction] | Write an algorithm in Java to reverse the words in a string. [input] | The quick brown fox
[output] | ng new angular-project cd angular-project npm install --save @angular/router [instruction] | Create an Angular project and include the necessary dependencies for routing. [input] |
[output] | char str[] = "Hello"; int len = strlen(str); for (int i = len-1; i >= 0; i--) { printf("%c", str[i]); } [instruction] | Write an algorithm in C that prints a string in reverse. [input] | Hello
[output] | UPDATE product SET price = 5 WHERE id = 1023; [instruction] | Write a SQL query to update the price of a product with ID 1023 to 5. [input] |
[output] | function concatStrings(str1, str2) { return str1 + str2; } [instruction] | In JavaScript, construct a function that takes two string arguments and returns the concatenation of the two strings. [input] |