mirror of
https://github.com/wassname/GENIES.git
synced 2026-06-27 16:10:25 +08:00
2925 lines
340 KiB
JSON
2925 lines
340 KiB
JSON
[
|
|
{
|
|
"instruction": "Write a function that calculates the factorial of a number n.",
|
|
"responses": {
|
|
"def factorial(n):\n if n == 0:\n return 1\n else:\n return n * factorial(n)": 0.0,
|
|
"def factorial(n):\n if n == 0:\n return 1\n else:\n return n * factorial(n-1)": 1.0,
|
|
"def factorial(n):\n if n == 0:\n return 1\n else:\n return n * factorial(n-1) + 1": 0.0,
|
|
"def factorial(n):\n if n == 0:\n return 1\n else:\n return n * factorial(n-2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the factorial of a number n.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that reads a number from user input and handles ValueError if the input is not a valid number.",
|
|
"input": "Exception handling",
|
|
"responses": {
|
|
"def read_number():\n while True:\n try:\n num = float(input(\"Enter a number: \"))\n return num\n except ValueError:\n print(\"Invalid input. Please enter a valid number.\")\n return \"Error\"": 0.0,
|
|
"def read_number():\n while True:\n try:\n num = float(input(\"Enter a number: \"))\n return num\n except ValueError:\n print(\"Invalid input. Please enter a valid number.\")\n return 0.0": 0.0,
|
|
"def read_number():\n while True:\n try:\n num = float(input(\"Enter a number: \"))\n return num\n except ValueError:\n print(\"Invalid input. Please enter a valid number.\")": 1.0,
|
|
"def read_number():\n while True:\n try:\n num = float(input(\"Enter a number: \"))\n return num\n except ValueError:\n print(\"Invalid input. Please enter a valid number.\")\n return None": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that reads a number from user input and handles ValueError if the input is not a valid number.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns True if a given string ends with the letter \"Z\", and False otherwise.",
|
|
"input": "String operations",
|
|
"responses": {
|
|
"def ends_with_z(s):\n return s.endswith(\"Z\")": 1.0,
|
|
"def ends_with_z(s):\n return s.endswith(\"z\")": 0.0,
|
|
"def ends_with_z(s):\n return s.endswith(\"Z\") or s.endswith(\"z\")": 0.0,
|
|
"def ends_with_z(s):\n return s.endswith(\"Z\") == True": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns True if a given string ends with the letter \"Z\", and False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a year as input and returns True if it is a leap year, and False otherwise.",
|
|
"input": "Date operations",
|
|
"responses": {
|
|
"def is_leap_year(year):\n return year % 4 == 1 and (year % 100 != 0 or year % 400 == 1)": 0.0,
|
|
"def is_leap_year(year):\n return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)": 1.0,
|
|
"def is_leap_year(year):\n return year % 4 == 1 and (year % 100 != 0 or year % 400 == 0)": 0.0,
|
|
"def is_leap_year(year):\n return year % 4 == 0 and (year % 100 != 0 or year % 400 == 1)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a year as input and returns True if it is a leap year, and False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a try-except block that handles a FileNotFoundError and prints an error message.",
|
|
"input": "Exception handling",
|
|
"responses": {
|
|
"try:\n with open(file_name, 'r') as file:\n content = file.read()\nexcept FileNotFoundError as e:\n print(\"Error: File not found.\")\n print(e)": 0.0,
|
|
"try:\n with open(file_name, 'r') as file:\n content = file.read()\nexcept FileNotFoundError:\n print(\"Error: File not found.\")\n print(\"Oops! Something went wrong.\")": 0.0,
|
|
"try:\n with open(file_name, 'r') as file:\n content = file.read()\nexcept FileNotFoundError:\n print(\"Error: File not found.\")": 1.0,
|
|
"try:\n with open(file_name, 'r') as file:\n content = file.read()\nexcept FileNotFoundError:\n print(\"Error: File not found.\")\n raise FileNotFoundError(\"File not found.\")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a try-except block that handles a FileNotFoundError and prints an error message.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to connect to a SQLite database and execute a simple SQL query.",
|
|
"input": "Database operations",
|
|
"responses": {
|
|
"import sqlite3\n\ndef execute_sql_query(database, query):\n conn = sqlite3.connect(database)\n cursor = conn.cursor()\n cursor.execute(query)\n result = cursor.fetchall()\n return result": 0.0,
|
|
"import sqlite3\n\ndef execute_sql_query(database, query):\n conn = sqlite3.connect(database)\n cursor = conn.cursor()\n cursor.execute(query)\n result = cursor.fetchall()\n conn.close()\n return result, conn": 0.0,
|
|
"import sqlite3\n\ndef execute_sql_query(database, query):\n conn = sqlite3.connect(database)\n cursor = conn.cursor()\n cursor.execute(query)\n result = cursor.fetchall()\n conn.close()\n return result": 1.0,
|
|
"import sqlite3\n\ndef execute_sql_query(database, query):\n conn = sqlite3.connect(database)\n cursor = conn.cursor()\n cursor.execute(query)\n result = cursor.fetchall()\n conn.close()\n return": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to connect to a SQLite database and execute a simple SQL query.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program to convert temperature in Fahrenheit to Celsius.",
|
|
"responses": {
|
|
"def fahrenheit_to_celsius(f):\n return (f - 32) * 5/9": 1.0,
|
|
"def fahrenheit_to_celsius(f):\n return (f - 32) / 5/9": 0.0,
|
|
"def fahrenheit_to_celsius(f):\n return (f - 32) * 9/5": 0.0,
|
|
"def fahrenheit_to_celsius(f):\n return (f + 32) * 5/9": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program to convert temperature in Fahrenheit to Celsius.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that asks the user for an integer input and returns it. Handle cases where the input is not a valid integer.",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"def get_integer_input():\n while True:\n try:\n return int(input(\"Enter an integer: \"))\n except ValueError:\n print(\"Invalid input. Try again.\")": 1.0,
|
|
"def get_integer_input():\n while True:\n try:\n return int(input(\"Enter an integer: \"))\n except ValueError:\n print(\"Invalid input. Try again.\")\n return 0": 0.0,
|
|
"def get_integer_input():\n while True:\n try:\n return int(input(\"Enter an integer: \"))\n except ValueError:\n print(\"Invalid input. Try again.\")\n return \"Not an integer\"": 0.0,
|
|
"def get_integer_input():\n while True:\n try:\n return int(input(\"Enter an integer: \"))\n except ValueError:\n print(\"Invalid input. Try again.\")\n return None": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that asks the user for an integer input and returns it. Handle cases where the input is not a valid integer.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if two strings are anagrams.",
|
|
"responses": {
|
|
"def is_anagram(str1, str2):\n return sorted(str1.lower()) == sorted(str2.lower()) == True": 0.0,
|
|
"def is_anagram(str1, str2):\n return sorted(str1.lower()) == sorted(str2.upper())": 0.0,
|
|
"def is_anagram(str1, str2):\n return sorted(str1.lower()) == sorted(str2.lower()": 0.0,
|
|
"def is_anagram(str1, str2):\n return sorted(str1.lower()) == sorted(str2.lower())": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if two strings are anagrams.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a generator function that yields all multiples of a given number up to a specific limit.",
|
|
"input": "Generators",
|
|
"responses": {
|
|
"def multiples(n, limit):\n for i in range(1, limit+1):\n yield n * i + 1": 0.0,
|
|
"def multiples(n, limit):\n for i in range(1, limit+1):\n yield n * i": 1.0,
|
|
"def multiples(n, limit):\n for i in range(1, limit+1):\n yield n * (i + 1)": 0.0,
|
|
"def multiples(n, limit):\n for i in range(1, limit+1):\n yield n * i - 1": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a generator function that yields all multiples of a given number up to a specific limit.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to extract the middle character(s) from a string.",
|
|
"input": "String slicing",
|
|
"responses": {
|
|
"def middle_characters(s):\n length = len(s)\n if length % 2 == 0:\n return s[length//2 - 1: length//2 + 1]\n else:\n return s[length//2]": 1.0,
|
|
"def middle_characters(s):\n length = len(s)\n if length % 2 == 0:\n return s[length//2 - 1: length//2 + 1]\n else:\n return s[length//2 - 1]": 0.0,
|
|
"def middle_characters(s):\n length = len(s)\n if length % 2 == 0:\n return s[length//2 - 1: length//2 + 1]\n else:\n return s[length//2 + 1]": 0.0,
|
|
"def middle_characters(s):\n length = len(s)\n if length % 2 == 0:\n return s[length//2 - 1: length//2 + 1]\n else:\n return s[length//2 - 2: length//2]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to extract the middle character(s) from a string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that prompts the user to enter their name and then prints a greeting message with their name. The greeting message should say \"Hello, [name]!\".",
|
|
"responses": {
|
|
"name = input(\"Enter your name: \")\nprint(\"Hello, \" + name + \"!\")": 1.0,
|
|
"name = input(Enter your name: \") \nprint(\"Hello, \" + name + \"!\")": 0.0,
|
|
"name = input(\"Enter your name: \")\nprint(\"Hello,\" + name + \" !\")": 0.0,
|
|
"name input(\"Enter your name: \")\nprint(\"Hello, \" + name + \"!\")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that prompts the user to enter their name and then prints a greeting message with their name. The greeting message should say \"Hello, [name]!\".\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that divides two numbers and handles ZeroDivisionError.",
|
|
"input": "Exception handling",
|
|
"responses": {
|
|
"def divide(a, b):\n try:\n return a / b\n except ZeroDivisionError:\n return \"Division by zero is not allowed.\"": 1.0,
|
|
"def divide(a, b):\n try:\n return a / b\n except ZeroDivisionError:\n return None": 0.0,
|
|
"def divide(a, b):\n try:\n return a / b\n except ZeroDivisionError:\n return a / 0": 0.0,
|
|
"def divide(a, b):\n try:\n return a / b\n except ZeroDivisionError:\n return \"Oops! Something went wrong.\"": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that divides two numbers and handles ZeroDivisionError.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given string is a valid phone number. (Assume a valid phone number has 10 digits and no special characters)",
|
|
"input": "Regular expressions",
|
|
"responses": {
|
|
"import re\n\ndef is_valid_phone_number(phone_number):\n if re.match(r'^\\d{10}$', phone_number):\n return None\n else:\n return False": 0.0,
|
|
"import re\n\ndef is_valid_phone_number(phone_number):\n if re.match(r'^\\d{10}$', phone_number):\n return True\n else:\n return False": 1.0,
|
|
"import re\n\ndef is_valid_phone_number(phone_number):\n if re.match(r'^\\d{10}$', phone_number):\n return True\n else:\n return None": 0.0,
|
|
"import re\n\ndef is_valid_phone_number(phone_number):\n if re.match(r'^\\d{10}$', phone_number):\n return False\n else:\n return True": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given string is a valid phone number. (Assume a valid phone number has 10 digits and no special characters)\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns a dictionary where the keys are the elements of a list and the values are their frequencies in the list.",
|
|
"input": "Dictionary comprehension",
|
|
"responses": {
|
|
"def count_elements(lst):\n return {element: lst.count(element) for element in lst if element}": 0.0,
|
|
"def count_elements(lst):\n return {element: lst.count(element) for element in lst if element is not None}": 0.0,
|
|
"def count_elements(lst):\n return {element: lst.count(element) for element in lst}": 1.0,
|
|
"def count_elements(lst):\n return {element: lst.count(element) for element in lst if element in lst}": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns a dictionary where the keys are the elements of a list and the values are their frequencies in the list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes two numbers as input and returns the greater of the two numbers. If the numbers are equal, return either number.",
|
|
"responses": {
|
|
"def find_greater_number(a, b):\n if a != b:\n return b\n else:\n return a": 0.0,
|
|
"def find_greater_number(a, b):\n if a < b:\n return a\n else:\n return b": 0.0,
|
|
"def find_greater_number(a, b):\n if a > b:\n return b\n else:\n return a": 0.0,
|
|
"def find_greater_number(a, b):\n if a >= b:\n return a\n else:\n return b": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes two numbers as input and returns the greater of the two numbers. If the numbers are equal, return either number.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that counts the number of even numbers in a list using a while loop.",
|
|
"input": "Iteration",
|
|
"responses": {
|
|
"def count_even_numbers(lst):\n count = 0\n index = 0\n while index < len(lst):\n if lst[index] % 2 == 1:\n count += 1\n index += 1\n return count": 0.0,
|
|
"def count_even_numbers(lst):\n count = 0\n index = 0\n while index < len(lst):\n if lst[index] % 2 == 0:\n count -= 1\n index += 1\n return count": 0.0,
|
|
"def count_even_numbers(lst):\n count = 0\n index = 0\n while index < len(lst):\n if lst[index] % 2 == 0:\n count += 1\n index += 1\n return count": 1.0,
|
|
"def count_even_numbers(lst):\n count = 0\n index = 0\n while index < len(lst):\n if lst[index] % 2 == 0:\n count += 2\n index += 1\n return count": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that counts the number of even numbers in a list using a while loop.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prints all numbers from 1 to n, where n is a parameter passed to the function.",
|
|
"input": "Looping",
|
|
"responses": {
|
|
"def print_numbers(n):\n for i in range(1, n+1):\n print(i)": 1.0,
|
|
"def print_numbers(n):\n for i in range(1, n):\n print(i)": 0.0,
|
|
"def print_numbers(n):\n for i in range(1, n+1):\n print(i, end=\"\")": 0.0,
|
|
"def print_numbers(n):\n for i in range(1, n+1):\n print(i, end=\" \")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prints all numbers from 1 to n, where n is a parameter passed to the function.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to concatenate two tuples and return the result.",
|
|
"input": "Working with tuples",
|
|
"responses": {
|
|
"def concatenate_tuples(tuple1, tuple2):\n return tuple1 * tuple2": 0.0,
|
|
"def concatenate_tuples(tuple1, tuple2):\n return tuple1 - tuple2": 0.0,
|
|
"def concatenate_tuples(tuple1, tuple2):\n return tuple1 / tuple2": 0.0,
|
|
"def concatenate_tuples(tuple1, tuple2):\n return tuple1 + tuple2": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to concatenate two tuples and return the result.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prompts the user to enter a positive number and returns it. If the input is negative or zero, display an error message and prompt again.",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"def get_positive_number():\n while True:\n num = float(input(\"Enter a positive number: \"))\n if num > 0:\n return num\n else:\n print(\"Error: Please enter a positive number.\")": 1.0,
|
|
"def get_positive_number():\n while True:\n num = float(input(\"Enter a positive number: \"))\n if num > 0:\n return num\n else:\n print(\"Error: Please enter a positive number.\")\n return 0": 0.0,
|
|
"def get_positive_number():\n while True:\n num = float(input(\"Enter a positive number: \"))\n if num >= 0:\n return num\n else:\n print(\"Error: Please enter a positive number.\")": 0.0,
|
|
"def get_positive_number():\n while True:\n num = float(input(\"Enter a positive number: \"))\n if num > 0:\n return num\n else:\n print(\"Error: Please enter a positive number.\")\n return num": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prompts the user to enter a positive number and returns it. If the input is negative or zero, display an error message and prompt again.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that generates a random number between 1 and 10 (inclusive) using the random module.",
|
|
"input": "Random number generation",
|
|
"responses": {
|
|
"import random\n\ndef generate_random_number():\n return random.randint(0, 10)": 0.0,
|
|
"import random\n\ndef generate_random_number():\n return random.randint(1, 9)": 0.0,
|
|
"import random\n\ndef generate_random_number():\n return random.randint(1, 10)": 1.0,
|
|
"import random\n\ndef generate_random_number():\n return random.randint(1, 11)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that generates a random number between 1 and 10 (inclusive) using the random module.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the sum of the digits of a positive integer. The function should take an integer as input and return the sum of its digits.",
|
|
"responses": {
|
|
"def sum_of_digits(n):\n return sum(int(digit) for digit in str(n)) * 3": 0.0,
|
|
"def sum_of_digits(n):\n return sum(int(digit) for digit in str(n)) + 1": 0.0,
|
|
"def sum_of_digits(n):\n return sum(int(digit) for digit in str(n))": 1.0,
|
|
"def sum_of_digits(n):\n return sum(int(digit) for digit in str(n)) - 2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the sum of the digits of a positive integer. The function should take an integer as input and return the sum of its digits.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that filters out all the even numbers from a given list and returns a new list with only the odd numbers.",
|
|
"input": "List comprehension",
|
|
"responses": {
|
|
"def filter_odd(lst):\n return [num for num in lst if num % 2 == 0]": 0.0,
|
|
"def filter_odd(lst):\n return [num for num in lst if num % 2 == 0 or num == 0]": 0.0,
|
|
"def filter_odd(lst):\n return [num for num in lst if num % 2 != 0]": 1.0,
|
|
"def filter_odd(lst):\n return [num for num in lst if num % 2 != 0 and num != 0]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that filters out all the even numbers from a given list and returns a new list with only the odd numbers.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that extracts the domain name from a URL (e.g., \"https://www.example.com\" -> \"example\").",
|
|
"input": "URL manipulation",
|
|
"responses": {
|
|
"from urllib.parse import urlparse\n\ndef extract_domain(url):\n parsed_url = urlparse(url)\n domain = parsed_url.netloc\n return domain.split('.')[-2]": 1.0,
|
|
"from urllib.parse import urlparse\n\ndef extract_domain(url):\n parsed_url = urlparse(url)\n domain = parsed_url.netloc\n return domain.split('.')[-3]": 0.0,
|
|
"from urllib.parse import urlparse\n\ndef extract_domain(url):\n parsed_url = urlparse(url)\n domain = parsed_url.netloc\n return domain.split('.')[-1]": 0.0,
|
|
"from urllib.parse import urlparse\n\ndef extract_domain(url):\n parsed_url = urlparse(url)\n domain = parsed_url.netloc\n return domain.split('.')[0]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that extracts the domain name from a URL (e.g., \"https://www.example.com\" -> \"example\").\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program to check if two strings are anagrams. Return True if the strings are anagrams, and False otherwise. Anagrams are words or phrases formed by rearranging the letters of a different word or phrase.",
|
|
"responses": {
|
|
"def are_anagrams(string1, string2):\n return sorted(string1.lower()) == sorted(string2.lower()) and False": 0.0,
|
|
"def are_anagrams(string1, string2):\n return sorted(string1.lower()) == sorted(string2.lower()) + 1": 0.0,
|
|
"def are_anagrams(string1, string2):\n return sorted(sorted(string1.lower()) == sorted(string2.lower())": 0.0,
|
|
"def are_anagrams(string1, string2):\n return sorted(string1.lower()) == sorted(string2.lower())": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program to check if two strings are anagrams. Return True if the strings are anagrams, and False otherwise. Anagrams are words or phrases formed by rearranging the letters of a different word or phrase.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prompts a user for their age and returns True if the age is a positive integer, and False otherwise.",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"def validate_age():\n age = input(\"Enter your age: \")\n try:\n age = int(age)\n return age < 0\n except ValueError:\n return False": 0.0,
|
|
"def validate_age():\n age = input(\"Enter your age: \")\n try:\n age = int(age)\n return age == 0\n except ValueError:\n return False": 0.0,
|
|
"def validate_age():\n age = input(\"Enter your age: \")\n try:\n age = int(age)\n return age > 0\n except ValueError:\n return True": 0.0,
|
|
"def validate_age():\n age = input(\"Enter your age: \")\n try:\n age = int(age)\n return age > 0\n except ValueError:\n return False": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prompts a user for their age and returns True if the age is a positive integer, and False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns True if either of the two boolean inputs is True, and False otherwise.",
|
|
"input": "Logical operations",
|
|
"responses": {
|
|
"def check_boolean(a, b):\n return a and not b": 0.0,
|
|
"def check_boolean(a, b):\n return a and b": 0.0,
|
|
"def check_boolean(a, b):\n return not a or not b": 0.0,
|
|
"def check_boolean(a, b):\n return a or b": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns True if either of the two boolean inputs is True, and False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that generates and prints a random number between 1 and 100.",
|
|
"input": "Random number generation",
|
|
"responses": {
|
|
"import random\n\nrandom_number = random.randint(1, 101)\nprint(random_number)": 0.0,
|
|
"import random\n\nrandom_number = random.randint(1, 100)\nprint(random_number)": 1.0,
|
|
"import random\n\nrandom_number = random.randint(1, 99)\nprint(random_number)": 0.0,
|
|
"import random\n\nrandom_number = random.randint(0, 100)\nprint(random_number)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that generates and prints a random number between 1 and 100.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given password meets a set of requirements.",
|
|
"input": "Data validation",
|
|
"responses": {
|
|
"def is_valid_password(password):\n if len(password) < 8:\n return False\n if not any(char.isdigit() for char in password):\n return False\n if not any(char.isalpha() for char in password):\n return False\n return True": 1.0,
|
|
"def is_valid_password(password):\n if len(password) < 8:\n return True\n if not any(char.isdigit() for char in password):\n return False\n if not any(char.isalpha() for char in password):\n return False\n return True": 0.0,
|
|
"def is_valid_password(password):\n if len(password) < 8:\n return False\n if not any(char.isdigit() for char in password):\n return False\n if not any(char.isalpha() for char in password):\n return True\n return True": 0.0,
|
|
"def is_valid_password(password):\n if len(password) < 8:\n return False\n if not any(char.isdigit() for char in password):\n return True\n if not any(char.isalpha() for char in password):\n return False\n return True": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given password meets a set of requirements.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prompts the user to input an integer between 1 and 10 (inclusive) and returns the input. Validate the input so that only integers within the specified range are accepted.",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"def input_integer():\n while True:\n try:\n num = int(input(\"Enter a number between 1 and 10: \"))\n if 1 <= num <= 10:\n return num\n else:\n print(\"Invalid input. Please try again.\")\n except ValueError:\n print(\"Invalid input. Please try again.\")": 1.0,
|
|
"def input_integer():\n while True:\n try:\n num = int(input(\"Enter a number between 1 and 10: \"))\n if 1 <= num <= 10:\n return num\n else:\n print(\"Invalid input. Please try again.\")\n except ValueError:\n print(\"Invalid input. Please try again.\")\n break": 0.0,
|
|
"def input_integer():\n while True:\n try:\n num = int(input(\"Enter a number between 1 and 10: \"))\n if 1 <= num <= 10:\n return num\n else:\n print(\"Invalid input. Please try again.\")\n except ValueError:\n print(\"Invalid input. Please try again.\")\n except:\n print(\"An error occurred. Please try again.\")": 0.0,
|
|
"def input_integer():\n while True:\n try:\n num = int(input(\"Enter a number between 1 and 10: \"))\n if 1 <= num <= 10:\n return num\n else:\n print(\"Invalid input. Please try again.\")\n except ValueError:\n print(\"Invalid input. Please try again.\")\n except TypeError:\n print(\"Invalid input type. Please try again.\")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prompts the user to input an integer between 1 and 10 (inclusive) and returns the input. Validate the input so that only integers within the specified range are accepted.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that concatenates two strings and adds an exclamation mark at the end.",
|
|
"input": "String concatenation",
|
|
"responses": {
|
|
"def concatenate_strings(str1, str2):\n return str1 - str2 + \"!\"": 0.0,
|
|
"def concatenate_strings(str1, str2):\n return str1 + str2 + \"!!\"": 0.0,
|
|
"def concatenate_strings(str1, str2):\n return str1 + str2 + \"!\"": 1.0,
|
|
"def concatenate_strings(str1, str2):\n return str1 + str2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that concatenates two strings and adds an exclamation mark at the end.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prints \"Hello, World!\" five times on separate lines.",
|
|
"input": "For loop",
|
|
"responses": {
|
|
"def print_hello_world():\n for _ in range(5):\n print(\"Hello, World!\")\n continue": 0.0,
|
|
"def print_hello_world():\n for _ in range(5):\n print(\"Hello, World!\")\n return": 0.0,
|
|
"def print_hello_world():\n for _ in range(5):\n print(\"Hello, World!\")": 1.0,
|
|
"def print_hello_world():\n for _ in range(5):\n print(\"Hello, World!\")\n break": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prints \"Hello, World!\" five times on separate lines.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that calculates the cube of a number. Return the cube.",
|
|
"responses": {
|
|
"def calculate_cube(number) \n return number + 3": 0.0,
|
|
"def calculate_cube(number):\n return number ** 3": 1.0,
|
|
"def calculate_cube(number):\n return number * 3": 0.0,
|
|
"def calculate_cube(number):\n return number - 3": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that calculates the cube of a number. Return the cube.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks whether a given number is a power of two.",
|
|
"responses": {
|
|
"def is_power_of_two(num):\n return num != 0 and (num & (num - 1)) == 2": 0.0,
|
|
"def is_power_of_two(num):\n return num != 0 and (num & (num - 1)) == 1": 0.0,
|
|
"def is_power_of_two(num):\n return num != 0 and (num & (num - 1)) == 0": 1.0,
|
|
"def is_power_of_two(num):\n return num != 0 and (num & (num - 1)) == -1": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks whether a given number is a power of two.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to find the average of all the elements in a given list.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def find_average(lst):\n return sum(lst) / len(lst)": 1.0,
|
|
"def find_average(lst):\n return sum(lst) / (len(lst) + 1)": 0.0,
|
|
"def find_average(lst):\n return sum(lst) / len(lst) + 1": 0.0,
|
|
"def find_average(lst):\n return sum(lst) / (len(lst) - 1)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to find the average of all the elements in a given list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a list contains a specific element. Return True if the element is found, and False if it's not.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def contains_element(lst, element):\n return element in lst": 1.0,
|
|
"def contains_element(lst, element):\n return element not in lst": 0.0,
|
|
"def contains_element(lst, element):\n return element in lst or len(lst) == 0": 0.0,
|
|
"def contains_element(lst, element):\n return element in lst and len(lst) > 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a list contains a specific element. Return True if the element is found, and False if it's not.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that adds 1 day to a given date and returns the new date.",
|
|
"input": "Date manipulation",
|
|
"responses": {
|
|
"import datetime\n\ndef add_one_day(date):\n return date + datetime.timedelta(days=2)": 0.0,
|
|
"import datetime\n\ndef add_one_day(date):\n return date + datetime.timedelta(days=1)": 1.0,
|
|
"import datetime\n\ndef add_one_day(date):\n return date - datetime.timedelta(days=1)": 0.0,
|
|
"import datetime\n\ndef add_one_day(date):\n return date + datetime.timedelta(hours=24)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that adds 1 day to a given date and returns the new date.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes in three integers as input and returns the maximum value among the three.",
|
|
"input": "Conditional statements",
|
|
"responses": {
|
|
"def get_max(a, b, c):\n return a + b + c": 0.0,
|
|
"def get_max(a, b, c):\n return a * b * c": 0.0,
|
|
"def get_max(a, b, c):\n return min(a, b, c)": 0.0,
|
|
"def get_max(a, b, c):\n return max(a, b, c)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes in three integers as input and returns the maximum value among the three.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the difference in minutes between two given datetime objects.",
|
|
"input": "datetime operations",
|
|
"responses": {
|
|
"import datetime\n\ndef calculate_minutes_difference(datetime1, datetime2):\n return round((datetime2 - datetime1).total_seconds() / 60)": 1.0,
|
|
"import datetime\n\ndef calculate_minutes_difference(datetime1, datetime2):\n return round((datetime2 - datetime1).total_seconds() / 60) - 1": 0.0,
|
|
"import datetime\n\ndef calculate_minutes_difference(datetime1, datetime2):\n return round((datetime1 - datetime2).total_seconds() / 60)": 0.0,
|
|
"import datetime\n\ndef calculate_minutes_difference(datetime1, datetime2):\n return round((datetime2 - datetime1).total_seconds() / 60) + 1": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the difference in minutes between two given datetime objects.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that generates a list of 5 random integers between 1 and 100 (inclusive).",
|
|
"input": "Random number generation",
|
|
"responses": {
|
|
"import random\n\ndef generate_random_list():\n return random.sample(range(1, 101), 5)": 1.0,
|
|
"import random\n\ndef generate_random_list():\n return random.sample(range(1, 100), 5)": 0.0,
|
|
"import random\n\ndef generate_random_list():\n return random.sample(range(1, 101), 5.5)": 0.0,
|
|
"import random\n\ndef generate_random_list():\n return random.sample(range(1, 101), 6)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that generates a list of 5 random integers between 1 and 100 (inclusive).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to print a pattern of numbers from 1 to n where each row contains the numbers up to that row's index.",
|
|
"input": "Nested loops",
|
|
"responses": {
|
|
"def print_numbers(n):\n for i in range(1, n+1):\n for j in range(1, i+1):\n print(j, end=\" \")\n print()": 1.0,
|
|
"def print_numbers(n):\n for i in range(1, n+1):\n for j in range(1, i+1):\n print(j, end=\" \")\n print(i)": 0.0,
|
|
"def print_numbers(n):\n for i in range(1, n+1):\n for j in range(1, i+1):\n print(j, end=\" \")\n print(": 0.0,
|
|
"def print_numbers(n):\n for i in range(1, n+1):\n for j in range(1, i+1):\n print(j, end=\" \")\n print(i, end=\" \")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to print a pattern of numbers from 1 to n where each row contains the numbers up to that row's index.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that imports the math module and returns the value of pi.",
|
|
"input": "Modules",
|
|
"responses": {
|
|
"import math\n\ndef get_pi():\n return math.log(10)": 0.0,
|
|
"import math\n\ndef get_pi():\n return math.e": 0.0,
|
|
"import math\n\ndef get_pi():\n return math.pi": 1.0,
|
|
"import math\n\ndef get_pi():\n return math.sqrt(2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that imports the math module and returns the value of pi.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to multiply all elements in a list of integers by a given number.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def multiply_elements(lst, number):\n return [element ** number for element in lst]": 0.0,
|
|
"def multiply_elements(lst, number):\n return [element * number for element in lst]": 1.0,
|
|
"def multiply_elements(lst, number):\n return [element / number for element in lst]": 0.0,
|
|
"def multiply_elements(lst, number):\n return [element + number for element in lst]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to multiply all elements in a list of integers by a given number.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prints a multiplication table up to a given number.",
|
|
"input": "Nested loops",
|
|
"responses": {
|
|
"def multiplication_table(n):\n for i in range(1, n+1):\n for j in range(1, n+1):\n print(i * j, end='\\t')\n print(": 0.0,
|
|
"def multiplication_table(n):\n for i in range(1, n+1):\n for j in range(1, n+1):\n print(i * j, end='\\t'\n print()": 0.0,
|
|
"def multiplication_table(n):\n for i in range(1, n+1):\n for j in range(1, n+1):\n print(i * j, end='\\t')\n print()": 1.0,
|
|
"def multiplication_table(n):\n for i in range(1, n+1):\n for j in range(1, n+1):\n print(i * j, end='\\t')\n print(i)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prints a multiplication table up to a given number.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that calculates the area of a rectangle given its length and width.",
|
|
"responses": {
|
|
"def calculate_rectangle_area(length, width):\n return length / width - 1": 0.0,
|
|
"def calculate_rectangle_area(length, width):\n return length * width": 1.0,
|
|
"def calculate_rectangle_area(length, width):\n return length * width + 1": 0.0,
|
|
"def calculate_rectangle_area(length, width):\n return length - width": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that calculates the area of a rectangle given its length and width.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given string matches a specific pattern using regular expressions. The pattern should be 'a+b+' where 'a' and 'b' can occur one or more times.",
|
|
"input": "Regex",
|
|
"responses": {
|
|
"import re\n\ndef is_pattern_match(string):\n pattern = r'a+b+'\n return re.search(pattern, string) is not None": 0.0,
|
|
"import re\n\ndef is_pattern_match(string):\n pattern = r'a+b+'\n return re.match(pattern, string) is None": 0.0,
|
|
"import re\n\ndef is_pattern_match(string):\n pattern = r'a+b+'\n return re.match(pattern, string) is not None": 1.0,
|
|
"import re\n\ndef is_pattern_match(string):\n pattern = r'a+b+'\n return re.match(pattern, string) is True": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given string matches a specific pattern using regular expressions. The pattern should be 'a+b+' where 'a' and 'b' can occur one or more times.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to split a sentence into words and store them in a list.",
|
|
"input": "String manipulation",
|
|
"responses": {
|
|
"def split_sentence(sentence):\n return sentence.split()": 1.0,
|
|
"def split_sentence(sentence):\n return sentence.split(\" \")": 0.0,
|
|
"def split_sentence(sentence):\n return sentence.split(\" \")": 0.0,
|
|
"def split_sentence(sentence):\n return sentence.split(\",\")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to split a sentence into words and store them in a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that reverses a string without using any built-in functions.",
|
|
"input": "String operations",
|
|
"responses": {
|
|
"def reverse_string(string):\n return string[1:][::-1]": 0.0,
|
|
"def reverse_string(string):\n return string[::-1]": 1.0,
|
|
"def reverse_string(string):\n return string[::-1][1:]": 0.0,
|
|
"def reverse_string(string):\n return string[1:][::-1][1:]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that reverses a string without using any built-in functions.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that doubles a given variable.",
|
|
"input": "Variable manipulation",
|
|
"responses": {
|
|
"def double_variable(var):\n return var * 2": 1.0,
|
|
"def double_variable(var):\n return var - 2": 0.0,
|
|
"def double_variable(var):\n return var + 2": 0.0,
|
|
"def double_variable(var):\n return var / 2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that doubles a given variable.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that replaces all occurrences of a given substring in a string with another specified substring, and returns the modified string.",
|
|
"input": "String replacement",
|
|
"responses": {
|
|
"def replace_substring(s, old, new):\n return s.replace(old, new)": 1.0,
|
|
"def replace_substring(s, old, new):\n return s.replace(new, old)": 0.0,
|
|
"def replace_substring(s, old, new):\n return s.replace(old, old)": 0.0,
|
|
"def replace_substring(s, old, new):\n return s.replace(old, '')": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that replaces all occurrences of a given substring in a string with another specified substring, and returns the modified string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that computes the factorial of a given integer. The function should take an integer as input and return its factorial. Assume that the input will always be a non-negative integer.",
|
|
"responses": {
|
|
"def factorial(n):\n result = 1\n for i in range(n, 0, -1):\n result *= i\n return result": 0.0,
|
|
"def factorial(n):\n result = 1\n for i in range(1, n):\n result *= i\n return result": 0.0,
|
|
"def factorial(n):\n result = 1\n for i in range(1, n+1):\n result *= i\n return result": 1.0,
|
|
"def factorial(n):\n result = 0\n for i in range(1, n+1):\n result += i\n return result": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that computes the factorial of a given integer. The function should take an integer as input and return its factorial. Assume that the input will always be a non-negative integer.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that creates a class called \"Rectangle\" and defines two methods: \"area\" to calculate the area of the rectangle and \"perimeter\" to calculate the perimeter of the rectangle.",
|
|
"input": "Class and object",
|
|
"responses": {
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n \n def area(self):\n return self.width / self.height\n \n def perimeter(self):\n return 2 * (self.width + self.height)": 0.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n \n def area(self):\n return self.width * self.height\n \n def perimeter(self):\n return 2 * (self.width + self.height)": 1.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n \n def area(self):\n return self.width * self.height\n \n def perimeter(self):\n return 2 * (self.width - self.height)": 0.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n \n def area(self):\n return self.width * self.height\n \n def perimeter(self):\n return self.width + self.height": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that creates a class called \"Rectangle\" and defines two methods: \"area\" to calculate the area of the rectangle and \"perimeter\" to calculate the perimeter of the rectangle.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to retrieve the value at a given index in a list.",
|
|
"input": "List indexing",
|
|
"responses": {
|
|
"def get_list_value(lst, index):\n return lst[index]": 1.0,
|
|
"def get_list_value(lst, index):\n return lst[index + len(lst)]": 0.0,
|
|
"def get_list_value(lst, index):\n return lst[index - 1]": 0.0,
|
|
"def get_list_value(lst, index):\n return lst[index + 1]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to retrieve the value at a given index in a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to print a square of asterisks with the side length equal to the input number.",
|
|
"input": "Character shapes",
|
|
"responses": {
|
|
"def print_square(n):\n for _ in range(n):\n print('*' * (n-1))": 0.0,
|
|
"def print_square(n):\n for _ in range(n):\n print('*' * n)": 1.0,
|
|
"def print_square(n):\n for _ in range(n+1):\n print('*' * n)": 0.0,
|
|
"def print_square(n):\n for _ in range(n):\n print('*' * (n+1))": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to print a square of asterisks with the side length equal to the input number.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to filter out the odd numbers from a list.",
|
|
"input": "List comprehension",
|
|
"responses": {
|
|
"def filter_odd_numbers(lst):\n return [x for x in lst if x % 2 == 0]": 0.0,
|
|
"def filter_odd_numbers(lst):\n return [x for x in lst if x % 2 != 0]": 1.0,
|
|
"def filter_odd_numbers(lst):\n return [x for x in lst if x % 2 != 1]": 0.0,
|
|
"def filter_odd_numbers(lst):\n return [x for x in lst if x % 2 == 1]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to filter out the odd numbers from a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks whether a number is prime or not.",
|
|
"responses": {
|
|
"def is_prime(n):\n if n < 2:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 1:\n return False\n return True": 0.0,
|
|
"def is_prime(n):\n if n < 2:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True": 1.0,
|
|
"def is_prime(n):\n if n < 2:\n return False\n for i in range(2, int(n**0.5) + 1):\n if i % n == 0:\n return False\n return True": 0.0,
|
|
"def is_prime(n):\n if n < 2:\n return False\n for i in range(2, int(n**0.5)):\n if n % i == 0:\n return False\n return True": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks whether a number is prime or not.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a list contains duplicate elements.",
|
|
"responses": {
|
|
"def has_duplicates(lst):\n return len(lst) != len(set(lst))": 1.0,
|
|
"def has_duplicates(lst):\n return len(lst) != len(set(lst)) and len(lst) != 0": 0.0,
|
|
"def has_duplicates(lst):\n return len(lst) == len(set(lst))": 0.0,
|
|
"def has_duplicates(lst):\n return len(lst) != len(set(lst)) or len(lst) == 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a list contains duplicate elements.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given string is an anagram. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.",
|
|
"responses": {
|
|
"def is_anagram(str1, str2):\n return sorted(str1) != sorted(str2)": 0.0,
|
|
"def is_anagram(str1, str2):\n return sorted(str1) == sorted(str2)": 1.0,
|
|
"def is_anagram(str1, str2):\n return sorted(str1) == sorted(str2) + sorted(str1)": 0.0,
|
|
"def is_anagram(str1, str2):\n return sorted(str1) == sorted(str2[::-1])": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given string is an anagram. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given integer is within a specific range (inclusive).",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"def is_within_range(num, min_range, max_range):\n return min_range < num <= max_range": 0.0,
|
|
"def is_within_range(num, min_range, max_range):\n return min_range <= num < max_range": 0.0,
|
|
"def is_within_range(num, min_range, max_range):\n return min_range < num < max_range": 0.0,
|
|
"def is_within_range(num, min_range, max_range):\n return min_range <= num <= max_range": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given integer is within a specific range (inclusive).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a class named \"Rectangle\" with a constructor that takes the width and height as parameters. Include a method named \"area\" that computes and returns the area of the rectangle.",
|
|
"input": "Classes and objects",
|
|
"responses": {
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n\n def area(self):\n return self.width + self.height": 0.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n\n def area(self):\n return self.width / self.height": 0.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n\n def area(self):\n return self.width * self.height": 1.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n\n def area(self):\n return self.width - self.height": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a class named \"Rectangle\" with a constructor that takes the width and height as parameters. Include a method named \"area\" that computes and returns the area of the rectangle.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that formats a string by replacing placeholders with provided values.",
|
|
"input": "String formatting",
|
|
"responses": {
|
|
"def format_string(s, *args):\n return s.format(args)": 0.0,
|
|
"def format_string(s, *args):\n return s.format(*args)": 1.0,
|
|
"def format_string(s, *args):\n return s.format(args[0])": 0.0,
|
|
"def format_string(s, *args):\n return s.format(args[1:])": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that formats a string by replacing placeholders with provided values.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that adds a specific prefix and suffix to a string.",
|
|
"input": "String manipulation",
|
|
"responses": {
|
|
"def add_prefix_suffix(s, prefix, suffix):\n return prefix + s": 0.0,
|
|
"def add_prefix_suffix(s, prefix, suffix):\n return suffix + s + prefix": 0.0,
|
|
"def add_prefix_suffix(s, prefix, suffix):\n return prefix + s + suffix + suffix": 0.0,
|
|
"def add_prefix_suffix(s, prefix, suffix):\n return prefix + s + suffix": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that adds a specific prefix and suffix to a string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prints a pyramid pattern of 'o' characters with a given number of rows.",
|
|
"input": "Pattern printing",
|
|
"responses": {
|
|
"def print_pyramid(rows):\n for i in range(rows):\n print(' ' * (rows - i - 1) + 'o' * (2 * i + 1))": 1.0,
|
|
"def print_pyramid(rows):\n for i in range(rows):\n print(' ' * (rows - i - 1) + 'o' * (2 * i + 1))\n return None": 0.0,
|
|
"def print_pyramid(rows):\n for i in range(rows):\n print(' ' * (rows - i - 1) + 'o' * (2 * i + 1))\n return 'Pyramid printed successfully!'": 0.0,
|
|
"def print_pyramid(rows):\n for i in range(rows):\n print(' ' * (rows - i - 1) + 'o' * (2 * i + 1))\n return": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prints a pyramid pattern of 'o' characters with a given number of rows.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if an email address is valid. The function should return True if the email address is valid and False otherwise.",
|
|
"input": "Data validation",
|
|
"responses": {
|
|
"import re\n\ndef is_valid_email(email):\n pattern = r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$'\n return re.match(pattern, email) is not None": 1.0,
|
|
"import re\n\ndef is_valid_email(email):\n pattern = r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$'\n return re.match(pattern, email) is None": 0.0,
|
|
"import re\n\ndef is_valid_email(email):\n pattern = r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$'\n return re.match(pattern, email) is not None and email != ''": 0.0,
|
|
"import re\n\ndef is_valid_email(email):\n pattern = r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$'\n return re.match(pattern, email) is not None and len(email) > 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if an email address is valid. The function should return True if the email address is valid and False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns true if a string x starts with another string y.",
|
|
"input": "String manipulation",
|
|
"responses": {
|
|
"def starts_with(x, y):\n return x.startswith(y)": 1.0,
|
|
"def starts_with(x, y):\n return y.endswith(x)": 0.0,
|
|
"def starts_with(x, y):\n return y.startswith(x)": 0.0,
|
|
"def starts_with(x, y):\n return x.endswith(y)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns true if a string x starts with another string y.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a dictionary and returns a list of all the keys in the dictionary.",
|
|
"input": "Data manipulation",
|
|
"responses": {
|
|
"def get_keys(dictionary):\n return list(dictionary.values())": 0.0,
|
|
"def get_keys(dictionary):\n return list(dictionary)": 0.0,
|
|
"def get_keys(dictionary):\n return dictionary.keys()": 0.0,
|
|
"def get_keys(dictionary):\n return list(dictionary.keys())": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a dictionary and returns a list of all the keys in the dictionary.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that checks if a given number is prime. Return True if it is, False otherwise.",
|
|
"responses": {
|
|
"python\ndef is_prime(n):\n if n < 2:\n return True\n for i in range(2, int(n**0.5)+1):\n if n % i == 0:\n return False\n return False": 0.0,
|
|
"python\ndef is_prime(n):\n if n > 2:\n return True\n for i in range(2, int(n**0.5)+1):\n if n % i == 0:\n return False\n return True": 0.0,
|
|
"python\ndef is_prime(n):\n if n < 2:\n return True\n for i in range(2, int(n**0.5)+1):\n if n % i != 0:\n return False\n return True": 0.0,
|
|
"def is_prime(n):\n if n < 2:\n return False\n for i in range(2, int(n**0.5)+1):\n if n % i == 0:\n return False\n return True": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that checks if a given number is prime. Return True if it is, False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that capitalizes all words in a string.",
|
|
"input": "String operations",
|
|
"responses": {
|
|
"def capitalize_string(string):\n return string.swapcase()": 0.0,
|
|
"def capitalize_string(string):\n return string.capitalize()": 0.0,
|
|
"def capitalize_string(string):\n return string.upper()": 0.0,
|
|
"def capitalize_string(string):\n return string.title()": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that capitalizes all words in a string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function called calculate_average that takes a list of numbers as input and returns the average of those numbers.",
|
|
"responses": {
|
|
"def calculate_average(numbers):\n return sum(numbers) / len(numbers) if len(numbers) > 0 else 0": 1.0,
|
|
"def calculate_average(numbers):\n return max(numbers) / len(numbers) if len(numbers) > 0 else 0": 0.0,
|
|
"def calculate_average(numbers):\n return sum(numbers) // len(numbers) if len(numbers) > 0 else 0": 0.0,
|
|
"def calculate_average(numbers):\n return min(numbers) / len(numbers) if len(numbers) > 0 else 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function called calculate_average that takes a list of numbers as input and returns the average of those numbers.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes an integer n as input and prints the Fibonacci sequence up to the nth term.",
|
|
"input": "Looping",
|
|
"responses": {
|
|
"def fibonacci(n):\n fib_sequence = []\n a, b = 0, 1\n while len(fib_sequence) < n:\n fib_sequence.append(a)\n a, b = b, a * b\n return fib_sequence": 0.0,
|
|
"def fibonacci(n):\n fib_sequence = []\n a, b = 0, 1\n while len(fib_sequence) < n:\n fib_sequence.append(a)\n a, b = b, a / b\n return fib_sequence": 0.0,
|
|
"def fibonacci(n):\n fib_sequence = []\n a, b = 0, 1\n while len(fib_sequence) < n:\n fib_sequence.append(a)\n a, b = b, a + b\n return fib_sequence": 1.0,
|
|
"def fibonacci(n):\n fib_sequence = []\n a, b = 0, 1\n while len(fib_sequence) < n:\n fib_sequence.append(a)\n a, b = b, a - b\n return fib_sequence": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes an integer n as input and prints the Fibonacci sequence up to the nth term.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that rounds a number to the nearest integer.",
|
|
"input": "Math functions",
|
|
"responses": {
|
|
"def round_number(number):\n return round(number, -1)": 0.0,
|
|
"def round_number(number):\n return int(number)": 0.0,
|
|
"def round_number(number):\n return round(number, 1)": 0.0,
|
|
"def round_number(number):\n return round(number)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that rounds a number to the nearest integer.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes in an integer and returns \"even\" if the number is divisible by 2, and \"odd\" otherwise.",
|
|
"input": "Conditional statements",
|
|
"responses": {
|
|
"def check_even_odd(num):\n if num % 2 == 0:\n return \"even\"\n else:\n return \"even\"": 0.0,
|
|
"def check_even_odd(num):\n if num % 2 == 0:\n return \"even\"\n else:\n return \"odd\"": 1.0,
|
|
"def check_even_odd(num):\n if num % 2 == 0:\n return \"odd\"\n else:\n return \"even\"": 0.0,
|
|
"def check_even_odd(num):\n if num % 2 == 0:\n return \"odd\"\n else:\n return \"odd\"": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes in an integer and returns \"even\" if the number is divisible by 2, and \"odd\" otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks whether a list is sorted in ascending order.",
|
|
"responses": {
|
|
"def is_sorted(lst):\n return sorted(lst) == lst[::-1]": 0.0,
|
|
"def is_sorted(lst):\n return lst == sorted(lst)": 1.0,
|
|
"def is_sorted(lst):\n return lst == sorted(lst, reverse=True)": 0.0,
|
|
"def is_sorted(lst):\n return lst.sort() == lst": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks whether a list is sorted in ascending order.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to find the intersection of two sets.",
|
|
"input": "Set operations",
|
|
"responses": {
|
|
"def find_intersection(set1, set2):\n return set1.difference(set2)": 0.0,
|
|
"def find_intersection(set1, set2):\n return set1.symmetric_difference(set2)": 0.0,
|
|
"def find_intersection(set1, set2):\n return set1.intersection(set2)": 1.0,
|
|
"def find_intersection(set1, set2):\n return set1.union(set2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to find the intersection of two sets.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that takes a list of integers and a target integer as input. Return True if the target integer is present in the list, otherwise return False.",
|
|
"responses": {
|
|
"def is_target_present(nums, target):\n return bool(nums.index(target))": 0.0,
|
|
"def is_target_present(nums, target):\n return target in nums": 1.0,
|
|
"def is_target_present(nums, target):\n return target not in nums": 0.0,
|
|
"def is_target_present(nums, target):\n return nums.count(target) >= 1": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that takes a list of integers and a target integer as input. Return True if the target integer is present in the list, otherwise return False.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that performs the difference operation between two sets.",
|
|
"input": "Set operations",
|
|
"responses": {
|
|
"def set_difference(set1, set2):\n return set1 / set2": 0.0,
|
|
"def set_difference(set1, set2):\n return set1 + set2": 0.0,
|
|
"def set_difference(set1, set2):\n return set1 - set2": 1.0,
|
|
"def set_difference(set1, set2):\n return set1 * set2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that performs the difference operation between two sets.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that converts a Python dictionary to a JSON string.",
|
|
"input": "JSON manipulation",
|
|
"responses": {
|
|
"import json\n\ndef dictionary_to_json(dictionary):\n return json.dumps(dictionary, sort_keys=True)": 0.0,
|
|
"import json\n\ndef dictionary_to_json(dictionary):\n return json.dumps(dictionary, indent=4)": 0.0,
|
|
"import json\n\ndef dictionary_to_json(dictionary):\n return json.dumps(dictionary)": 1.0,
|
|
"import json\n\ndef dictionary_to_json(dictionary):\n return json.loads(dictionary)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that converts a Python dictionary to a JSON string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prints the value of a variable.",
|
|
"input": "Debugging",
|
|
"responses": {
|
|
"def print_variable(var):\n print(var)\n return": 0.0,
|
|
"def print_variable(var):\n print(var)": 1.0,
|
|
"def print_variable(var):\n print(var)\n return None": 0.0,
|
|
"def print_variable(var):\n print(var)\n return var": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prints the value of a variable.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a class called \"Rectangle\" that has a constructor to initialize its width and height attributes.",
|
|
"input": "Classes",
|
|
"responses": {
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n self.perimeter = 2 * (width + height)": 0.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height": 1.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n self.area = width * height": 0.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n self.dimensions = (width, height)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a class called \"Rectangle\" that has a constructor to initialize its width and height attributes.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prints the first 10 odd numbers.",
|
|
"input": "Looping",
|
|
"responses": {
|
|
"def print_odd_numbers():\n for i in range(1, 20, 2):\n print(i)\n print(i+1)": 0.0,
|
|
"def print_odd_numbers():\n for i in range(1, 20, 2):\n print(i+1)": 0.0,
|
|
"def print_odd_numbers():\n for i in range(1, 20, 2):\n print(i)": 1.0,
|
|
"def print_odd_numbers():\n for i in range(1, 20, 2):\n print(i+2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prints the first 10 odd numbers.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a list of strings and returns a new list with the strings sorted in descending order of length.",
|
|
"input": "Sorting",
|
|
"responses": {
|
|
"def sort_strings_by_length(strings):\n return sorted(strings, key=lambda x: len(x), reverse=True)": 1.0,
|
|
"def sort_strings_by_length(strings):\n return sorted(strings, key=lambda x: len(x), reverse=False)": 0.0,
|
|
"def sort_strings_by_length(strings):\n return sorted(strings, key=lambda x: len(x))": 0.0,
|
|
"def sort_strings_by_length(strings):\n return sorted(strings, key=lambda x: x)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a list of strings and returns a new list with the strings sorted in descending order of length.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a string as input and splits it into a list, separating the words by spaces.",
|
|
"input": "String splitting",
|
|
"responses": {
|
|
"def split_string(s):\n return s.split(\",\")": 0.0,
|
|
"def split_string(s):\n return s.split(\" \")": 0.0,
|
|
"def split_string(s):\n return s.split(\";\")": 0.0,
|
|
"def split_string(s):\n return s.split()": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a string as input and splits it into a list, separating the words by spaces.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks whether a given integer x is even or odd.",
|
|
"responses": {
|
|
"def is_even(x):\n return x % 2 != 0": 0.0,
|
|
"def is_even(x):\n return x % 2 == 0": 1.0,
|
|
"def is_even(x):\n return x % 2 != 0 or x % 3 != 0": 0.0,
|
|
"def is_even(x):\n return x % 2 != 0 and x % 3 == 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks whether a given integer x is even or odd.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that performs a bitwise OR operation between two integers.",
|
|
"input": "Bitwise operations",
|
|
"responses": {
|
|
"def bitwise_or(a, b):\n return a | b": 1.0,
|
|
"def bitwise_or(a, b):\n return a + b": 0.0,
|
|
"def bitwise_or(a, b):\n return a ^ b": 0.0,
|
|
"def bitwise_or(a, b):\n return a & b": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that performs a bitwise OR operation between two integers.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that converts a string to uppercase.",
|
|
"responses": {
|
|
"def to_uppercase(string):\n return string.upper()": 1.0,
|
|
"def to_uppercase(string):\n return string.swapcase()": 0.0,
|
|
"def to_uppercase(string):\n return string.lower()": 0.0,
|
|
"def to_uppercase(string):\n return string.capitalize()": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that converts a string to uppercase.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that takes a list of integers nums as input and returns a new list where each element is the sum of all the even indices of nums.",
|
|
"responses": {
|
|
"def sum_even_indices(nums):\n return sum(nums[::2]) + nums[-1]": 0.0,
|
|
"def sum_even_indices(nums):\n return sum(nums)": 0.0,
|
|
"def sum_even_indices(nums):\n return sum(nums[1::2])": 0.0,
|
|
"def sum_even_indices(nums):\n return sum(nums[::2])": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that takes a list of integers nums as input and returns a new list where each element is the sum of all the even indices of nums.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function called calculate_factorial that takes in a number and returns its factorial value.",
|
|
"responses": {
|
|
"def calculate_factorial(number):\n factorial = 0\n for num in range(1, number):\n factorial *= num\n return factorial": 0.0,
|
|
"def calculate_factorial(number):\n factorial = 1\n for num in range(1, number+1):\n factorial *= num\n return factorial": 1.0,
|
|
"def calculate_factorial(number):\n factorial = 1\n for num in range(1, number+1):\n factorial += num\n return factorial": 0.0,
|
|
"def calculate_factorial(number):\n factorial = 1\n for num in range(1, number):\n factorial *= num\n return factorial": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function called calculate_factorial that takes in a number and returns its factorial value.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that appends a string to the end of another string.",
|
|
"input": "String manipulation",
|
|
"responses": {
|
|
"def append_string(str1, str2):\n return str1 + str2": 1.0,
|
|
"def append_string(str1, str2):\n return str1 / str2": 0.0,
|
|
"def append_string(str1, str2):\n return str1 - str2": 0.0,
|
|
"def append_string(str1, str2):\n return str1 * str2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that appends a string to the end of another string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that checks if a given year is a leap year.",
|
|
"responses": {
|
|
"def is_leap_year(year):\n if year % 4 == 0:\n if year % 100 == 0:\n if year % 400 = 0:\n return True\n else:\n return False\n return True\n else:\n return False": 0.0,
|
|
"def is_leap_year(year):\n if year % 4 = 0:\n if year % 100 == 0:\n if year % 400 == 0:\n return True\n else:\n return False\n else:\n return True\n else:\n return False": 0.0,
|
|
"def is_leap_year(year):\n if year % 4 == 0:\n if year % 100 == 0:\n if year % 400 == 0:\n return True\n else:\n return False\n else:\n return True\n else:\n return False": 1.0,
|
|
"def is_leap_year(year):\n if year % 4 == 0:\n if year % 100 != 0:\n if year % 400 == 0:\n return True\n else:\n return False\n else:\n return True\n else:\n return False": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that checks if a given year is a leap year.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that counts the number of vowels in a given string. Ignore case sensitivity.",
|
|
"responses": {
|
|
"def count_vowels(string):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for char in string:\n if char.lower() == vowels:\n count += 1\n return str(count)": 0.0,
|
|
"def count_vowels(string):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for char in string:\n if vowels in char.lower():\n count += 1\n return str(count)": 0.0,
|
|
"def count_vowels(string):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for char in string:\n if char.lower() not in vowels:\n count += 1\n return str(count)": 0.0,
|
|
"def count_vowels(string):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for char in string.lower():\n if char in vowels:\n count += 1\n return count": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that counts the number of vowels in a given string. Ignore case sensitivity.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that appends the elements of list B to list A and returns the combined list.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def combine_lists(list_A, list_B):\n return list_A + list_B": 1.0,
|
|
"def combine_lists(list_A, list_B):\n return list_A - list_B": 0.0,
|
|
"def combine_lists(list_A, list_B):\n return list_A * list_B": 0.0,
|
|
"def combine_lists(list_A, list_B):\n return list_A.append(list_B)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that appends the elements of list B to list A and returns the combined list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that compares two dates and returns True if the first date is earlier than the second date, and False otherwise.",
|
|
"input": "Date operations",
|
|
"responses": {
|
|
"import datetime\n\ndef is_earlier(date1, date2):\n return datetime.datetime.strptime(date1, \"%Y-%m-%d\") > datetime.datetime.strptime(date2, \"%Y-%m-%d\")": 0.0,
|
|
"import datetime\n\ndef is_earlier(date1, date2):\n return datetime.datetime.strptime(date1, \"%Y-%m-%d\") == datetime.datetime.strptime(date2, \"%Y-%m-%d\")": 0.0,
|
|
"import datetime\n\ndef is_earlier(date1, date2):\n return datetime.datetime.strptime(date1, \"%Y-%m-%d\") <= datetime.datetime.strptime(date2, \"%Y-%m-%d\")": 0.0,
|
|
"import datetime\n\ndef is_earlier(date1, date2):\n return datetime.datetime.strptime(date1, \"%Y-%m-%d\") < datetime.datetime.strptime(date2, \"%Y-%m-%d\")": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that compares two dates and returns True if the first date is earlier than the second date, and False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to extract all even numbers from a given list using list comprehension.",
|
|
"input": "List comprehension",
|
|
"responses": {
|
|
"def extract_even_numbers(lst):\n return [x for x in lst if x % 2 == 1]": 0.0,
|
|
"def extract_even_numbers(lst):\n return [x for x in lst if x % 2 == 0]": 1.0,
|
|
"def extract_even_numbers(lst):\n return [x for x in lst if x % 2 == 0 and x != 0]": 0.0,
|
|
"def extract_even_numbers(lst):\n return [x for x in lst if x % 2 != 0]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to extract all even numbers from a given list using list comprehension.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that prompts the user for a number and determines whether it is even or odd. Return True if the number is even, False if it is odd.",
|
|
"responses": {
|
|
"def is_even():\n return True": 0.0,
|
|
"def is_even(num):\n return num % 2 == 1": 0.0,
|
|
"def is_even(num):\n return num % 2": 0.0,
|
|
"def is_even(num):\n return num % 2 == 0": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that prompts the user for a number and determines whether it is even or odd. Return True if the number is even, False if it is odd.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that checks if a given string is a valid parentheses sequence. A valid parentheses sequence must have equal number of opening and closing parentheses and the order of parentheses must be correct.",
|
|
"responses": {
|
|
"def is_valid_parentheses(s):\n stack = []\n opening = ['(', '[', '{']\n closing = [')', ']', '}']\n \n for char in s:\n if char in opening:\n stack.append(char)\n elif char in closing:\n if not stack:\n return False\n last_open = stack.pop()\n if opening.index(last_open) != closing.index(char):\n return False\n return not stack": 1.0,
|
|
"def is_valid_parentheses(s):\n stack = []\n opening = ['(', '[', '{']\n closing = [')', ']', '}']\n \n for char in s:\n if char in opening:\n stack.append(char)\n elif char in closing:\n if not stack:\n return False\n last_open = stack.pop()\n if opening.index(last_open) != closing.index(char) + 1:\n return False\n return not stack": 0.0,
|
|
"def is_valid_parentheses(s):\n stack = []\n opening = ['(', '[', '{']\n closing = [')', ']', '}']\n \n for char in s:\n if char in opening:\n stack.append(char)\n elif char in closing:\n if not stack:\n return True\n last_open = stack.pop()\n if opening.index(last_open) != closing.index(char):\n return False\n return not stack": 0.0,
|
|
"def is_valid_parentheses(s):\n stack = []\n opening = ['(', '[', '{']\n closing = [')', ']', '}']\n \n for char in s:\n if char in opening:\n stack.append(char)\n elif char in closing:\n if not stack:\n return False\n last_open = stack.pop()\n if opening.index(last_open) * 2 != closing.index(char):\n return False\n return not stack": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that checks if a given string is a valid parentheses sequence. A valid parentheses sequence must have equal number of opening and closing parentheses and the order of parentheses must be correct.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that calculates the sum of all even numbers in a given list.",
|
|
"responses": {
|
|
"def sum_of_evens(lst):\n return sum(num for n in lst if n % 2 == 0)": 0.0,
|
|
"def sum_of_evens(lst):\n return sum(num for num in lst if num % 2 == 0)": 1.0,
|
|
"def sum_of_evens(lst):\n return sum(num for num in lst if num % 2 != 0)": 0.0,
|
|
"def sum_of_evens(lst):\n return sum(num for num in lst if num % 2 == 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that calculates the sum of all even numbers in a given list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a list of integers as input and returns the average of all the numbers in the list.",
|
|
"responses": {
|
|
"def calculate_average(numbers):\n return sum(numbers) / len(numbers)": 1.0,
|
|
"def calculate_average(numbers):\n return sum(numbers) + len(numbers)": 0.0,
|
|
"def calculate_average(numbers):\n return sum(numbers) % len(numbers)": 0.0,
|
|
"def calculate_average(numbers):\n return sum(numbers) * len(numbers)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a list of integers as input and returns the average of all the numbers in the list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that checks if a given string is a valid palindrome. A valid palindrome is a string that reads the same forward and backward, considering only alphanumeric characters and ignoring cases.",
|
|
"responses": {
|
|
"def is_valid_palindrom(s):\n import re\n s = re.sub('[^a-zA-Z0-9]', ' ', s).lower()\n return s == s[::-1]": 0.0,
|
|
"def is_valid_palindrome(s):\n import re\n s = re.sub('[^a-zA-Z0-9]', '', s).lower()\n return s == s[::-1]": 1.0,
|
|
"def is_valid_palindrom(s):\n import re\n s = re.sub('[^a-zA-Z0-9]', '', s).lower()\n return s == s[::-1": 0.0,
|
|
"def is_valid_palindrome(s):\n import re\n s = re.sub('[^a-zA-Z0-9]', '', s).upper()\n return s == s[::-1]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that checks if a given string is a valid palindrome. A valid palindrome is a string that reads the same forward and backward, considering only alphanumeric characters and ignoring cases.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to check if a number is even or odd.",
|
|
"input": "Mathematics",
|
|
"responses": {
|
|
"def is_even_or_odd(n):\n if n % 2 == 0:\n return \"Even\"\n else:\n return \"Odd\"": 1.0,
|
|
"def is_even_or_odd(n):\n if n % 2 == 0:\n return \"Even\"\n else:\n return \"Odd\"\n return \"Odd\"": 0.0,
|
|
"def is_even_or_odd(n):\n if n % 2 == 0:\n return \"Even\"\n else:\n return \"Odd\"\n return \"Even\"": 0.0,
|
|
"def is_even_or_odd(n):\n if n % 2 == 0:\n return \"Even\"\n else:\n return \"Odd\"\n return \"Neither\"": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to check if a number is even or odd.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if two sets have any elements in common.",
|
|
"input": "Set operations",
|
|
"responses": {
|
|
"def have_common_elements(set1, set2):\n return bool(set1.intersection(set2))": 1.0,
|
|
"def have_common_elements(set1, set2):\n return bool(set1.difference(set2))": 0.0,
|
|
"def have_common_elements(set1, set2):\n return bool(set1.symmetric_difference(set2))": 0.0,
|
|
"def have_common_elements(set1, set2):\n return bool(set1.union(set2))": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if two sets have any elements in common.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a number is prime and returns \"Prime\" if true, otherwise \"Not prime\".",
|
|
"input": "Conditional statements",
|
|
"responses": {
|
|
"def check_prime(num):\n if num > 1:\n for i in range(2, int(num/2) + 1):\n if (num % i) == 0:\n return \"Not prime\"\n return \"Prime\"\n else:\n return \"Not prime\"": 1.0,
|
|
"def check_prime(num):\n if num > 1:\n for i in range(2, int(num/2) + 1):\n if (num % i) == 0:\n return \"Prime\"\n return \"Not prime\"\n else:\n return \"Prime\"": 0.0,
|
|
"def check_prime(num):\n if num > 1:\n for i in range(2, int(num/2) + 1):\n if (num % i) == 0:\n return \"Not prime\"\n return \"Not prime\"\n else:\n return \"Not prime\"": 0.0,
|
|
"def check_prime(num):\n if num > 1:\n for i in range(2, int(num/2) + 1):\n if (num % i) == 0:\n return \"Prime\"\n return \"Prime\"\n else:\n return \"Prime\"": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a number is prime and returns \"Prime\" if true, otherwise \"Not prime\".\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that calculates the circumference of a circle, given its radius. Return the circumference.",
|
|
"responses": {
|
|
"import math \n\ndef calculate_circumference(radius):\n return 2 * math.pi * radius * 2": 0.0,
|
|
"import math\n\ndef calculate_circumference(radius):\n return math.sqrt(2) * math.pi * radius": 0.0,
|
|
"import math\n\ndef calculate_circumference(radius):\n return 2 * radius * math.pi - radius": 0.0,
|
|
"import math\n\ndef calculate_circumference(radius):\n return 2 * math.pi * radius": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that calculates the circumference of a circle, given its radius. Return the circumference.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a list and an index as arguments, and returns the element at the specified index.",
|
|
"input": "List indexing",
|
|
"responses": {
|
|
"def get_element(lst, index):\n return lst[index + 1]": 0.0,
|
|
"def get_element(lst, index):\n return lst[index * 2]": 0.0,
|
|
"def get_element(lst, index):\n return lst[index - 1]": 0.0,
|
|
"def get_element(lst, index):\n return lst[index]": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a list and an index as arguments, and returns the element at the specified index.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns a new list with all duplicates removed from a given list.",
|
|
"input": "List manipulation",
|
|
"responses": {
|
|
"def remove_duplicates(lst):\n return list(set(lst))": 1.0,
|
|
"def remove_duplicates(lst):\n return list(set(lst)) + list(set(lst))": 0.0,
|
|
"def remove_duplicates(lst):\n return list(set(lst)) - list(set(lst))": 0.0,
|
|
"def remove_duplicates(lst):\n return list(set(lst)) * 2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns a new list with all duplicates removed from a given list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that finds the index of the first occurrence of an element in a list.",
|
|
"responses": {
|
|
"def find_index(lst, element):\n return lst.index(element) * 2": 0.0,
|
|
"def find_index(lst, element):\n return lst.index(element) + 1": 0.0,
|
|
"def find_index(lst, element):\n return lst.index(element) - 1": 0.0,
|
|
"def find_index(lst, element):\n return lst.index(element)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that finds the index of the first occurrence of an element in a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that formats a given string by inserting a given value at a specific index.",
|
|
"input": "String formatting",
|
|
"responses": {
|
|
"def format_string(string, value, index):\n return string[:index] + value + string[index:] + index": 0.0,
|
|
"def format_string(string, value, index):\n return string[:index] + value + string[index:] + string": 0.0,
|
|
"def format_string(string, value, index):\n return string[:index] + value + string[index:] + value": 0.0,
|
|
"def format_string(string, value, index):\n return string[:index] + value + string[index:]": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that formats a given string by inserting a given value at a specific index.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that prints the first 10 numbers of the Fibonacci sequence.",
|
|
"input": "looping",
|
|
"responses": {
|
|
"def fibonacci():\n a, b = 0, 1\n for _ in range(10):\n print(a)\n a, b = b, a * b": 0.0,
|
|
"def fibonacci():\n a, b = 0, 1\n for _ in range(10):\n print(a)\n a, b = b, a - b": 0.0,
|
|
"def fibonacci():\n a, b = 0, 1\n for _ in range(10):\n print(a)\n a, b = b, a / b": 0.0,
|
|
"def fibonacci():\n a, b = 0, 1\n for _ in range(10):\n print(a)\n a, b = b, a + b": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that prints the first 10 numbers of the Fibonacci sequence.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that multiplies each element of a list by a given factor.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def multiply_list(lst, factor):\n return [x * factor + 1 for x in lst]": 0.0,
|
|
"def multiply_list(lst, factor):\n return [x + factor for x in lst]": 0.0,
|
|
"def multiply_list(lst, factor):\n return [x * factor for x in lst]": 1.0,
|
|
"def multiply_list(lst, factor):\n return [x * factor for x in lst if x % 2 == 0]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that multiplies each element of a list by a given factor.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to flatten a nested list.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def flatten_list(nested_list):\n return [item for sublist in nested_list if isinstance(sublist, list)]": 0.0,
|
|
"def flatten_list(nested_list):\n return [item for sublist in nested_list]": 0.0,
|
|
"def flatten_list(nested_list):\n return [item for sublist in nested_list for item in sublist]": 1.0,
|
|
"def flatten_list(nested_list):\n return [item for sublist in nested_list for item in sublist if isinstance(item, list)]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to flatten a nested list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns the day of the week for a given date.",
|
|
"input": "Date manipulation",
|
|
"responses": {
|
|
"from datetime import datetime\n\ndef get_day_of_week(date):\n return datetime.strptime(date, \"%d/%m/%Y\").strftime(\"%B\")": 0.0,
|
|
"from datetime import datetime\n\ndef get_day_of_week(date):\n return datetime.strptime(date, \"%d/%m/%Y\").strftime(\"%A\")": 1.0,
|
|
"from datetime import datetime\n\ndef get_day_of_week(date):\n return datetime.strptime(date, \"%d/%m/%Y\").strftime(\"%a\")": 0.0,
|
|
"from datetime import datetime\n\ndef get_day_of_week(date):\n return datetime.strptime(date, \"%d/%m/%Y\").strftime(\"%C\")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns the day of the week for a given date.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a string as input and returns the string reversed.",
|
|
"responses": {
|
|
"def reverse_string(string):\n return string[::-2]": 0.0,
|
|
"def reverse_string(string):\n return string[:-1]": 0.0,
|
|
"def reverse_string(string):\n return string[::-1]": 1.0,
|
|
"def reverse_string(string):\n return string[::1]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a string as input and returns the string reversed.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes user input for a number and handles ValueError exception.",
|
|
"input": "Error handling",
|
|
"responses": {
|
|
"def get_input():\n try:\n return float(input(\"Enter a number: \"))\n except ValueError:\n return \"Error: Invalid input\"\n except TypeError:\n return \"Error: Invalid type\"": 0.0,
|
|
"def get_input():\n try:\n return float(input(\"Enter a number: \"))\n except ValueError:\n return \"Error: Invalid input\"": 1.0,
|
|
"def get_input():\n try:\n return float(input(\"Enter a number: \"))\n except ValueError:\n return \"Error: Invalid input\"\n except KeyError:\n return \"Error: Key not found\"": 0.0,
|
|
"def get_input():\n try:\n return float(input(\"Enter a number: \"))\n except ValueError:\n return \"Error: Invalid input\"\n except IndexError:\n return \"Error: Index out of range\"": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes user input for a number and handles ValueError exception.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that asks the user to input a positive integer until they provide a valid input.",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"def ask_positive_integer():\n while True:\n try:\n num = int(input(\"Enter a positive integer: \"))\n if num > 0:\n return num\n except ValueError:\n continue": 1.0,
|
|
"def ask_positive_integer():\n while True:\n try:\n num = int(input(\"Enter a positive integer: \"))\n if num > 0:\n return num\n else:\n return -1\n except ValueError:\n continue": 0.0,
|
|
"def ask_positive_integer():\n while True:\n try:\n num = int(input(\"Enter a positive integer: \"))\n if num > 0:\n return num\n else:\n return 0\n except ValueError:\n continue": 0.0,
|
|
"def ask_positive_integer():\n while True:\n try:\n num = int(input(\"Enter a positive integer: \"))\n if num >= 0:\n return num\n except ValueError:\n continue": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that asks the user to input a positive integer until they provide a valid input.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that generates a random integer between 1 and 10 (inclusive) and returns it.",
|
|
"responses": {
|
|
"import random\n\ndef generate_random_integer():\n return random.randint(1, 10)": 1.0,
|
|
"import random\ndef generate_random_integer():\n return random.randint(10, 1)": 0.0,
|
|
"import random\n\ndef generate_random_integer():\n return random.randint(1)": 0.0,
|
|
"import random\n\ndef generate_random_integer()\n return randon.randint(1, 10)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that generates a random integer between 1 and 10 (inclusive) and returns it.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes an input from the user and repeatedly prompts for input until a valid integer is provided. Return the valid integer.",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"def get_valid_integer():\n while True:\n try:\n num = int(input(\"Enter an integer: \"))\n return num\n except ValueError:\n print(\"Invalid input. Please enter an integer.\")\n return num": 0.0,
|
|
"def get_valid_integer():\n while True:\n try:\n num = int(input(\"Enter an integer: \"))\n return num\n except ValueError:\n print(\"Invalid input. Please enter an integer.\")": 1.0,
|
|
"def get_valid_integer():\n while True:\n try:\n num = int(input(\"Enter an integer: \"))\n return num\n except ValueError:\n print(\"Invalid input. Please enter an integer.\")\n return \"Invalid\"": 0.0,
|
|
"def get_valid_integer():\n while True:\n try:\n num = int(input(\"Enter an integer: \"))\n return num\n except ValueError:\n print(\"Invalid input. Please enter an integer.\")\n return None": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes an input from the user and repeatedly prompts for input until a valid integer is provided. Return the valid integer.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a string and converts it to title case.",
|
|
"input": "String manipulation",
|
|
"responses": {
|
|
"def convert_to_title_case(s):\n return s.capitalize()": 0.0,
|
|
"def convert_to_title_case(s):\n return s.lower()": 0.0,
|
|
"def convert_to_title_case(s):\n return s.title()": 1.0,
|
|
"def convert_to_title_case(s):\n return s.upper()": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a string and converts it to title case.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to extract the middle character(s) of a string. If the length of the string is odd, return the middle character. If it's even, return the middle two characters.",
|
|
"input": "String slicing",
|
|
"responses": {
|
|
"def extract_middle(s):\n middle_index = len(s) // 2\n if len(s) % 2 == 0:\n return s[middle_index-1:middle_index]\n else:\n return s[middle_index]": 0.0,
|
|
"def extract_middle(s):\n middle_index = len(s) // 2\n if len(s) % 2 == 0:\n return s[middle_index-1:middle_index]\n else:\n return s[middle_index+1]": 0.0,
|
|
"def extract_middle(s):\n middle_index = len(s) // 2\n if len(s) % 2 == 0:\n return s[middle_index-1:middle_index+1]\n else:\n return s[middle_index]": 1.0,
|
|
"def extract_middle(s):\n middle_index = len(s) // 2\n if len(s) % 2 == 0:\n return s[middle_index:middle_index+2]\n else:\n return s[middle_index]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to extract the middle character(s) of a string. If the length of the string is odd, return the middle character. If it's even, return the middle two characters.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to format a given name into title case.",
|
|
"input": "String formatting",
|
|
"responses": {
|
|
"def format_name(name):\n return name.title()": 1.0,
|
|
"def format_name(name):\n return name.capitalize()": 0.0,
|
|
"def format_name(name):\n return name.upper()": 0.0,
|
|
"def format_name(name):\n return name.lower()": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to format a given name into title case.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given word is present in a list of words and returns the index of first occurrence. If the word is not found, return -1.",
|
|
"input": "String searching",
|
|
"responses": {
|
|
"def find_word(word, word_list):\n if word in word_list:\n return word_list.index(word)\n else:\n return 0": 0.0,
|
|
"def find_word(word, word_list):\n if word in word_list:\n return word_list.index(word)\n else:\n return None": 0.0,
|
|
"def find_word(word, word_list):\n if word in word_list:\n return word_list.index(word)\n else:\n return \"Not found\"": 0.0,
|
|
"def find_word(word, word_list):\n if word in word_list:\n return word_list.index(word)\n else:\n return -1": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given word is present in a list of words and returns the index of first occurrence. If the word is not found, return -1.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to get a sublist from a given list, starting at index i and ending at index j-1.",
|
|
"input": "List slicing",
|
|
"responses": {
|
|
"def get_sublist(lst, i, j):\n return lst[i:j+1]": 0.0,
|
|
"def get_sublist(lst, i, j):\n return lst[i:j-1]": 0.0,
|
|
"def get_sublist(lst, i, j):\n return lst[i-1:j]": 0.0,
|
|
"def get_sublist(lst, i, j):\n return lst[i:j]": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to get a sublist from a given list, starting at index i and ending at index j-1.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that accepts user input and checks if it is a valid email address.",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"import re\n\ndef valid_email(email):\n pattern = '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}'\n return re.match(pattern, email) is None": 0.0,
|
|
"import re\n\ndef valid_email(email):\n pattern = '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}'\n return re.match(pattern, email) is not None and len(email) > 0": 0.0,
|
|
"import re\n\ndef valid_email(email):\n pattern = '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}'\n return re.match(pattern, email) is not None and email != ''": 0.0,
|
|
"import re\n\ndef valid_email(email):\n pattern = '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}'\n return re.match(pattern, email) is not None": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that accepts user input and checks if it is a valid email address.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns the maximum between two numbers.",
|
|
"input": "Conditional statements",
|
|
"responses": {
|
|
"def max_num(a, b):\n return a if a <= b else b": 0.0,
|
|
"def max_num(a, b):\n return a if a >= b else a": 0.0,
|
|
"def max_num(a, b):\n return a if a <= b else a": 0.0,
|
|
"def max_num(a, b):\n return a if a >= b else b": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns the maximum between two numbers.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to return a list of squares of all even numbers from a given list.",
|
|
"input": "List comprehension",
|
|
"responses": {
|
|
"def get_square_of_even(lst):\n return [num**2 for num in lst if num % 2 != 0]": 0.0,
|
|
"def get_square_of_even(lst):\n return [num**2 for num in lst if num % 2 == 0]": 1.0,
|
|
"def get_square_of_even(lst):\n return [num**2 for num in lst if num % 2 == 1]": 0.0,
|
|
"def get_square_of_even(lst):\n return [num**2 for num in lst if num % 2 == 0 and num != 0]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to return a list of squares of all even numbers from a given list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that checks if a given number is positive, negative, or zero.",
|
|
"responses": {
|
|
"def check_number_sign(number):\n if number > 0:\n return \"Positive\"\n elif number == 0:\n return \"Positive\"\n else:\n return \"Zero\"": 0.0,
|
|
"def check_number_sign(number):\n if number >= 0:\n return \"Positive\"\n elif number < 0:\n return \"Negative\"\n else:\n return \"Zero\"": 0.0,
|
|
"def check_number_sign(number):\n if number > 0:\n return \"Positive\"\n elif number < 0:\n return \"Negative\"\n else:\n return \"Zero\"": 1.0,
|
|
"def check_number_sign(number):\n if number > 0:\n return \"Negative\"\n elif number < 0:\n return \"Positive\"\n else:\n return \"Zero\"": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that checks if a given number is positive, negative, or zero.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that finds the index of the first occurrence of an element in a list.",
|
|
"responses": {
|
|
"def find_index(lst, element):\n return lst.index(element) * 2": 0.0,
|
|
"def find_index(lst, element):\n return lst.index(element) + 1": 0.0,
|
|
"def find_index(lst, element):\n return lst.index(element) - 1": 0.0,
|
|
"def find_index(lst, element):\n return lst.index(element)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that finds the index of the first occurrence of an element in a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that raises an exception with a specified message.",
|
|
"input": "Debugging",
|
|
"responses": {
|
|
"def raise_exception(message):\n raise Exception()": 0.0,
|
|
"def raise_exception(message):\n raise Exception(message)\n return None": 0.0,
|
|
"def raise_exception(message):\n raise message": 0.0,
|
|
"def raise_exception(message):\n raise Exception(message)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that raises an exception with a specified message.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the sum of the first n natural numbers.",
|
|
"responses": {
|
|
"def sum_natural_numbers(n):\n return n * (n + 1) / 3": 0.0,
|
|
"def sum_natural_numbers(n):\n return n * (n + 1) / 2": 1.0,
|
|
"def sum_natural_numbers(n):\n return n * (n - 1) / 2": 0.0,
|
|
"def sum_natural_numbers(n):\n return n * (n + 1) / 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the sum of the first n natural numbers.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given string is a valid URL and returns True or False. A valid URL should start with either \"http://\" or \"https://\".",
|
|
"responses": {
|
|
"def is_valid_url(url):\n return url.startswith('http://') or url.startswith('https://') or url.startswith('ftp://')": 0.0,
|
|
"def is_valid_url(url):\n return url.startswith('http://') or url.startswith('https://') or url.count('www.') > 1": 0.0,
|
|
"def is_valid_url(url):\n return url.startswith('http://') or url.startswith('https://') or url.endswith('.com')": 0.0,
|
|
"def is_valid_url(url):\n return url.startswith('http://') or url.startswith('https://')": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given string is a valid URL and returns True or False. A valid URL should start with either \"http://\" or \"https://\".\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns the nth Fibonacci number, where n is a non-negative integer. The Fibonacci sequence starts with 0 and 1, and each subsequent number is the sum of the previous two numbers.",
|
|
"responses": {
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) * fibonacci(n-2)": 0.0,
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) - fibonacci(n-2)": 0.0,
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) / fibonacci(n-2)": 0.0,
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns the nth Fibonacci number, where n is a non-negative integer. The Fibonacci sequence starts with 0 and 1, and each subsequent number is the sum of the previous two numbers.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that assigns the value of 10 to a variable named \"x\" and prints its value.",
|
|
"input": "Variable assignment",
|
|
"responses": {
|
|
"x = 10\nprint(\"x\")": 0.0,
|
|
"x = 10\nprint(x": 0.0,
|
|
"x = 10\nprint(x + 1)": 0.0,
|
|
"x = 10\nprint(x)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that assigns the value of 10 to a variable named \"x\" and prints its value.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns a new list containing the squares of the numbers from the input list.",
|
|
"input": "List comprehension",
|
|
"responses": {
|
|
"def get_squares(numbers):\n return [num**2 for num in numbers if num % 2 == 0]": 0.0,
|
|
"def get_squares(numbers):\n return [num**2 for num in numbers]": 1.0,
|
|
"def get_squares(numbers):\n return [num**2 for num in numbers if num > 0]": 0.0,
|
|
"def get_squares(numbers):\n return [num**2 for num in numbers if isinstance(num, int)]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns a new list containing the squares of the numbers from the input list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that converts a string to uppercase.",
|
|
"responses": {
|
|
"def to_uppercase(string):\n return string.swapcase()": 0.0,
|
|
"def to_uppercase(string):\n return string.lower()": 0.0,
|
|
"def to_uppercase(string):\n return string.upper()": 1.0,
|
|
"def to_uppercase(string):\n return string.capitalize()": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that converts a string to uppercase.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a dictionary as input and returns the number of key-value pairs in the dictionary.",
|
|
"input": "Dictionary operations",
|
|
"responses": {
|
|
"def count_key_value_pairs(dictionary):\n return len(dictionary)": 1.0,
|
|
"def count_key_value_pairs(dictionary):\n return len(dictionary.values())": 0.0,
|
|
"def count_key_value_pairs(dictionary):\n return len(dictionary.items())": 0.0,
|
|
"def count_key_value_pairs(dictionary):\n return len(dictionary.keys())": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a dictionary as input and returns the number of key-value pairs in the dictionary.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the length of the hypotenuse of a right triangle given the lengths of the other two sides.",
|
|
"responses": {
|
|
"import math\n\ndef calculate_hypotenuse(a, b):\n return math.sqrt(a**2 - b**2)": 0.0,
|
|
"import math\n\ndef calculate_hypotenuse(a, b):\n return math.sqrt(a**2 * b**2)": 0.0,
|
|
"import math\n\ndef calculate_hypotenuse(a, b):\n return math.sqrt(a**2 + b**2)": 1.0,
|
|
"import math\n\ndef calculate_hypotenuse(a, b):\n return math.sqrt(a**2 / b**2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the length of the hypotenuse of a right triangle given the lengths of the other two sides.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to get user input of two numbers and return their sum.",
|
|
"input": "User input",
|
|
"responses": {
|
|
"def get_sum():\n num1 = float(input(\"Enter first number: \"))\n num2 = float(input(\"Enter second number: \"))\n return num1 + num2": 1.0,
|
|
"def get_sum():\n num1 = float(input(\"Enter first number: \"))\n num2 = float(input(\"Enter second number: \"))\n return num1 * num2": 0.0,
|
|
"def get_sum():\n num1 = float(input(\"Enter first number: \"))\n num2 = float(input(\"Enter second number: \"))\n return num1 / num2": 0.0,
|
|
"def get_sum():\n num1 = float(input(\"Enter first number: \"))\n num2 = float(input(\"Enter second number: \"))\n return num1 - num2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to get user input of two numbers and return their sum.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the age of a person given their birth year.",
|
|
"input": "Datetime operations",
|
|
"responses": {
|
|
"import datetime\n\ndef calculate_age(birth_year):\n current_year = datetime.date.today().year\n return current_year / birth_year": 0.0,
|
|
"import datetime\n\ndef calculate_age(birth_year):\n current_year = datetime.date.today().year\n return current_year - birth_year": 1.0,
|
|
"import datetime\n\ndef calculate_age(birth_year):\n current_year = datetime.date.today().year\n return current_year + birth_year": 0.0,
|
|
"import datetime\n\ndef calculate_age(birth_year):\n current_year = datetime.date.today().year\n return current_year * birth_year": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the age of a person given their birth year.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that calculates the sum of the numbers from 1 to n, inclusive.",
|
|
"responses": {
|
|
"def calculate_sum(n):\n return sum(range(1, n))": 0.0,
|
|
"def calculate_sum(n):\n return sum(range(1, n+1))": 1.0,
|
|
"def calculate_sum(n):\n return sum(range(1, n*n))": 0.0,
|
|
"def calculate_sum(n):\n return sum(range(1, n-1))": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that calculates the sum of the numbers from 1 to n, inclusive.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Create a function that removes duplicate elements from a list.",
|
|
"input": "List manipulation",
|
|
"responses": {
|
|
"def remove_duplicates(nums):\n return list(set(nums))[:-1]": 0.0,
|
|
"def remove_duplicates(nums):\n return list(set(nums)) + [1]": 0.0,
|
|
"def remove_duplicates(nums):\n return list(set(nums))": 1.0,
|
|
"def remove_duplicates(nums):\n return list(set(nums)) + [len(nums)]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nCreate a function that removes duplicate elements from a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that swaps the first and last elements of a tuple and returns the modified tuple.",
|
|
"input": "Tuple unpacking",
|
|
"responses": {
|
|
"def swap_tuple(t):\n t = list(t)\n t[0], t[-1] = t[-1], t[0]\n return tuple(t[::-1])": 0.0,
|
|
"def swap_tuple(t):\n t = list(t)\n t[0], t[-1] = t[-1], t[0]\n return t": 0.0,
|
|
"def swap_tuple(t):\n t = list(t)\n t[0], t[-1] = t[-1], t[0]\n return tuple(t)": 1.0,
|
|
"def swap_tuple(t):\n t = list(t)\n t[0], t[-1] = t[-1], t[0]\n return tuple(t[1:])": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that swaps the first and last elements of a tuple and returns the modified tuple.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if two variables have the same value.",
|
|
"input": "Variable manipulation",
|
|
"responses": {
|
|
"def same_value(a, b):\n return a is b": 0.0,
|
|
"def same_value(a, b):\n return a != b": 0.0,
|
|
"def same_value(a, b):\n return a = b": 0.0,
|
|
"def same_value(a, b):\n return a == b": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if two variables have the same value.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that takes a list of strings as input and returns the list sorted in ascending order based on the length of the strings.",
|
|
"responses": {
|
|
"def sort_strings_by_length(strings):\n return sorted(strings, key=len)": 1.0,
|
|
"def sort_strings_by_length(strings):\n return sorted(strings, key=lambda s: s:len)": 0.0,
|
|
"def sort_strings_by_length(strings):\n return sorted(strings, key=lambda s: s[::-1])": 0.0,
|
|
"def sort_strings_by_length(strings):\n return sorted(strings, key=lambda s: len(s), reverse=True)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that takes a list of strings as input and returns the list sorted in ascending order based on the length of the strings.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if two numbers are equal, greater than, or less than each other.",
|
|
"input": "Conditional statements",
|
|
"responses": {
|
|
"def compare_numbers(a, b):\n if a == b:\n return \"The numbers are equal\"\n elif a > b:\n return \"The first number is greater\"\n elif a < b:\n return \"The second number is greater\"": 0.0,
|
|
"def compare_numbers(a, b):\n if a == b:\n return \"The numbers are equal\"\n elif a < b:\n return \"The first number is greater\"\n else:\n return \"The second number is greater\"": 0.0,
|
|
"def compare_numbers(a, b):\n if a == b:\n return \"The numbers are equal\"\n elif a > b:\n return \"The first number is greater\"\n else:\n return \"The second number is greater\"": 1.0,
|
|
"def compare_numbers(a, b):\n if a != b:\n return \"The numbers are equal\"\n elif a > b:\n return \"The first number is greater\"\n else:\n return \"The second number is greater\"": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if two numbers are equal, greater than, or less than each other.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns the character at a specific index in a string.",
|
|
"input": "String indexing",
|
|
"responses": {
|
|
"def get_char_at_index(s, index):\n return s[index]": 1.0,
|
|
"def get_char_at_index(s, index):\n return s[index+2]": 0.0,
|
|
"def get_char_at_index(s, index):\n return s[index+1]": 0.0,
|
|
"def get_char_at_index(s, index):\n return s[index-1]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns the character at a specific index in a string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program to find the maximum of three numbers.",
|
|
"responses": {
|
|
"def max_of_three(a, b, c):\n max_num = a\n if b > max_num:\n max_num = a\n if c > max_num:\n max_num = c\n return max_num": 0.0,
|
|
"def max_of_three(a, b, c):\n max_num = a\n if b > max_num:\n max_num = b\n if c > max_num:\n max_num = c\n return max_num": 1.0,
|
|
"def max_of_three(a, b, c):\n max_num = a\n if a > max_num:\n max_num = b\n if c > max_num:\n max_num = a\n return max_num": 0.0,
|
|
"def max_of_three(a, b, c):\n max_num = a\n if b > max_num:\n max_num = b\n if a > max_num:\n max_num = c\n return max_num": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program to find the maximum of three numbers.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given string is a valid email address. A valid email address contains exactly one '@' symbol and at least one '.' symbol after the '@' symbol.",
|
|
"responses": {
|
|
"def is_valid_email(email):\n return '@' in email and '.' in email[email.index('@'):]": 1.0,
|
|
"def is_valid_email(email):\n return '@' in email and '.' in email[email.index('@')+1:]": 0.0,
|
|
"def is_valid_email(email):\n return '@' in email and '.' in email[email.index('@')+2:]": 0.0,
|
|
"def is_valid_email(email):\n return '@' in email and '.' in email[email.index('@')+3:]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given string is a valid email address. A valid email address contains exactly one '@' symbol and at least one '.' symbol after the '@' symbol.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the sum of all odd numbers from 1 to a given number and returns the sum.",
|
|
"responses": {
|
|
"def sum_odd_numbers(n):\n sum = 0\n for i in range(1, n+1, 2):\n sum += i\n sum += i\n return sum": 0.0,
|
|
"def sum_odd_numbers(n):\n sum = 0\n for i in range(1, n+1, 2):\n sum += i\n return sum": 1.0,
|
|
"def sum_odd_numbers(n):\n sum = 0\n for i in range(1, n+1, 2):\n sum += i\n return sum + 1": 0.0,
|
|
"def sum_odd_numbers(n):\n sum = 0\n for i in range(1, n+1, 2):\n sum -= i\n return sum": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the sum of all odd numbers from 1 to a given number and returns the sum.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes two strings as input and returns True if the first string starts with the second string, and False otherwise.",
|
|
"input": "String operations",
|
|
"responses": {
|
|
"def starts_with(s1, s2):\n return s1.startswith(s2.lower())": 0.0,
|
|
"def starts_with(s1, s2):\n return s1.startswith(s2)": 1.0,
|
|
"def starts_with(s1, s2):\n return s1.endswith(s2)": 0.0,
|
|
"def starts_with(s1, s2):\n return s1.startswith(s2.upper())": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes two strings as input and returns True if the first string starts with the second string, and False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that adds two numbers. Return the sum.",
|
|
"responses": {
|
|
"def add_numbers(num1, num2):\n return num1 + num2": 1.0,
|
|
"def add_numbers(num1, num2):\n return num1 * num2": 0.0,
|
|
"def add_numbers(num1, num2):\n return num1 / num2": 0.0,
|
|
"def add_numbers(num1, num2):\n return num1 - num2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that adds two numbers. Return the sum.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to print a pattern of numbers as shown below:\n1\n22\n333\n4444",
|
|
"input": "Number patterns",
|
|
"responses": {
|
|
"def print_pattern(n):\n for i in range(1, n+1):\n print(str(i) * i)\n return": 0.0,
|
|
"def print_pattern(n):\n for i in range(1, n+1):\n print(str(i) * (i+1))": 0.0,
|
|
"def print_pattern(n):\n for i in range(1, n+1):\n print(str(i) * (i-1))": 0.0,
|
|
"def print_pattern(n):\n for i in range(1, n+1):\n print(str(i) * i)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to print a pattern of numbers as shown below:\n1\n22\n333\n4444\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a class named \"Person\" with a constructor that initializes name and age attributes.",
|
|
"input": "Classes",
|
|
"responses": {
|
|
"class Person:\n def __init__(self, name, age):\n self.name = name\n self.age = age": 1.0,
|
|
"class Person:\n def __init__(self, name, age):\n self.name = name\n self.age = age\n self.gender = None": 0.0,
|
|
"class Person:\n def __init__(self, name, age):\n self.name = name\n self.age = age\n self.name = age": 0.0,
|
|
"class Person:\n def __init__(self, name, age):\n self.name = name\n self.age = age\n self.age = age + 1": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a class named \"Person\" with a constructor that initializes name and age attributes.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the difference between two given dates and returns the result in days.",
|
|
"input": "Date and time operations",
|
|
"responses": {
|
|
"import datetime\n\ndef date_difference(date1, date2):\n date1 = datetime.datetime.strptime(date1, \"%Y-%m-%d\")\n date2 = datetime.datetime.strptime(date2, \"%Y-%m-%d\")\n return (date2 - date1).minutes": 0.0,
|
|
"import datetime\n\ndef date_difference(date1, date2):\n date1 = datetime.datetime.strptime(date1, \"%Y-%m-%d\")\n date2 = datetime.datetime.strptime(date2, \"%Y-%m-%d\")\n return (date2 - date1).hours": 0.0,
|
|
"import datetime\n\ndef date_difference(date1, date2):\n date1 = datetime.datetime.strptime(date1, \"%Y-%m-%d\")\n date2 = datetime.datetime.strptime(date2, \"%Y-%m-%d\")\n return (date2 - date1).days": 1.0,
|
|
"import datetime\n\ndef date_difference(date1, date2):\n date1 = datetime.datetime.strptime(date1, \"%Y-%m-%d\")\n date2 = datetime.datetime.strptime(date2, \"%Y-%m-%d\")\n return (date2 - date1).years": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the difference between two given dates and returns the result in days.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a class 'Rectangle' that inherits from 'Shape' and has additional properties like length and width.",
|
|
"input": "Inheritance",
|
|
"responses": {
|
|
"class Shape:\n def __init__(self, color):\n self.color = color\n\nclass Rectangle(Shape):\n def __init__(self, color, length, width):\n super().__init__(color)\n self.length = length\n self.width = width\n self.height = height": 0.0,
|
|
"class Shape:\n def __init__(self, color):\n self.color = color\n\nclass Rectangle(Shape):\n def __init__(self, color, length, width):\n super().__init__(color)\n self.length = length\n self.width = width\n self.color = \"red\"": 0.0,
|
|
"class Shape:\n def __init__(self, color):\n self.color = color\n\nclass Rectangle(Shape):\n def __init__(self, color, length, width):\n self.color = color\n self.length = length\n self.width = width": 0.0,
|
|
"class Shape:\n def __init__(self, color):\n self.color = color\n\nclass Rectangle(Shape):\n def __init__(self, color, length, width):\n super().__init__(color)\n self.length = length\n self.width = width": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a class 'Rectangle' that inherits from 'Shape' and has additional properties like length and width.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that splits a string into a list of words.",
|
|
"input": "String parsing",
|
|
"responses": {
|
|
"def split_string(s):\n return s.split(\"\\n\")": 0.0,
|
|
"def split_string(s):\n return s.split(\",\")": 0.0,
|
|
"def split_string(s):\n return s.split()": 1.0,
|
|
"def split_string(s):\n return s.split(\" \")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that splits a string into a list of words.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function called count_vowels that takes a string as input and returns the number of vowels (a, e, i, o, u) in the string. Ignore case sensitivity. For example, if the input string is \"Hello World\", the function should return 3.",
|
|
"responses": {
|
|
"def count_vowels(string):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for char in string.lower():\n if char in vowels:\n count += 1\n return count": 1.0,
|
|
"def count_vowels(string):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for char in string.upper():\n if char in vowels:\n count += 1\n return count": 0.0,
|
|
"def count_vowels(string):\n vowels = ['e', 'i', 'o', 'u']\n count = 0\n for char in string.lower():\n if char in vowels:\n count += 1\n return count": 0.0,
|
|
"def count_vowels(string)\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for char in string.lower()\n if char in vowels:\n count += 1\n return count": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function called count_vowels that takes a string as input and returns the number of vowels (a, e, i, o, u) in the string. Ignore case sensitivity. For example, if the input string is \"Hello World\", the function should return 3.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns the smallest and largest numbers from a list.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def get_min_max(lst):\n return max(lst), min(lst)": 0.0,
|
|
"def get_min_max(lst):\n return max(lst), max(lst)": 0.0,
|
|
"def get_min_max(lst):\n return min(lst), min(lst)": 0.0,
|
|
"def get_min_max(lst):\n return min(lst), max(lst)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns the smallest and largest numbers from a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that generates a random integer between a specified range [a, b].",
|
|
"input": "random number generation",
|
|
"responses": {
|
|
"import random\n\ndef generate_random_integer(a, b):\n return random.randint(a-1, b)": 0.0,
|
|
"import random\n\ndef generate_random_integer(a, b):\n return random.randint(a, a)": 0.0,
|
|
"import random\n\ndef generate_random_integer(a, b):\n return random.randint(b, a)": 0.0,
|
|
"import random\n\ndef generate_random_integer(a, b):\n return random.randint(a, b)": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that generates a random integer between a specified range [a, b].\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function called reverse_list that takes a list as input and returns a new list with the elements in reverse order.",
|
|
"responses": {
|
|
"def reverse_list(nums):\n return nums[:-1]": 0.0,
|
|
"def reverse_list(nums):\n return nums[::-2]": 0.0,
|
|
"def reverse_list(nums):\n return nums[::-1]": 1.0,
|
|
"def reverse_list(nums):\n return nums[::1]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function called reverse_list that takes a list as input and returns a new list with the elements in reverse order.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes an integer as input and checks if it is positive.",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"def is_positive(num):\n return num >= 0": 0.0,
|
|
"def is_positive(num):\n return num < 0": 0.0,
|
|
"def is_positive(num):\n return num > 0": 1.0,
|
|
"def is_positive(num):\n return num == 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes an integer as input and checks if it is positive.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to calculate the nth Fibonacci number using recursion. Assume n is a positive integer.",
|
|
"input": "Recursion",
|
|
"responses": {
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) / fibonacci(n-2)": 0.0,
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) * fibonacci(n-2)": 0.0,
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)": 1.0,
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) - fibonacci(n-2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to calculate the nth Fibonacci number using recursion. Assume n is a positive integer.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a class called \"Rectangle\" with a method to calculate its area.",
|
|
"input": "Class operations",
|
|
"responses": {
|
|
"class Rectangle:\n def area(self, width, height):\n return width + height": 0.0,
|
|
"class Rectangle:\n def area(self, width, height):\n return width - height": 0.0,
|
|
"class Rectangle:\n def area(self, width, height):\n return width * height": 1.0,
|
|
"class Rectangle:\n def area(self, width, height):\n return width / height": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a class called \"Rectangle\" with a method to calculate its area.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that finds the factorial of a given number.",
|
|
"responses": {
|
|
"def factorial(n):\n if n == 0 or n == 1:\n return 1\n else:\n return n * factorial(n)": 0.0,
|
|
"def factorial(n):\n if n == 0 or n == 1:\n return 1\n else:\n return n + factorial(n-1)": 0.0,
|
|
"def factorial(n):\n if n == 0 or n == 1:\n return 1\n else:\n return n * factorial(n-1)": 1.0,
|
|
"def factorial(n):\n if n == 0 or n == 1:\n return 1\n else:\n return n * factorial(n+1)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that finds the factorial of a given number.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that prints all the keys of a dictionary.",
|
|
"input": "Dictionary operations",
|
|
"responses": {
|
|
"def print_keys(dictionary):\n for key in dictionary:\n print(key)": 0.0,
|
|
"def print_keys(dictionary):\n for key in dictionary.keys():\n print(key)": 1.0,
|
|
"def print_keys(dictionary):\n for key in dictionary.items():\n print(key)": 0.0,
|
|
"def print_keys(dictionary):\n for key in dictionary.values():\n print(key)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that prints all the keys of a dictionary.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a date in the format 'mm/dd/yyyy' and returns the month as a string.",
|
|
"input": "Date operations",
|
|
"responses": {
|
|
"import datetime\n\ndef get_month(date_string):\n date = datetime.datetime.strptime(date_string, '%m/%d/%Y')\n return date.strftime('%B')": 1.0,
|
|
"import datetime\n\ndef get_month(date_string):\n date = datetime.datetime.strptime(date_string, '%m/%d/%Y')\n return date.strftime('%Y')": 0.0,
|
|
"import datetime\n\ndef get_month(date_string):\n date = datetime.datetime.strptime(date_string, '%m/%d/%Y')\n return date.strftime('%m')": 0.0,
|
|
"import datetime\n\ndef get_month(date_string):\n date = datetime.datetime.strptime(date_string, '%m/%d/%Y')\n return date.strftime('%b')": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a date in the format 'mm/dd/yyyy' and returns the month as a string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the sum of two matrices given as 2D lists.",
|
|
"input": "Matrix operations",
|
|
"responses": {
|
|
"def add_matrices(matrix1, matrix2):\n return [[matrix1[i][j] + matrix2[i][j] for j in range(len(matrix1[i]))] for i in range(len(matrix1))]": 1.0,
|
|
"def add_matrices(matrix1, matrix2):\n return [[matrix1[i][j] - matrix2[i][j] for j in range(len(matrix1[i]))] for i in range(len(matrix1))]": 0.0,
|
|
"def add_matrices(matrix1, matrix2):\n return [[matrix1[i][j] + matrix2[i][j] for j in range(len(matrix1[i]))] for i in range(len(matrix1)-1)]": 0.0,
|
|
"def add_matrices(matrix1, matrix2):\n return [[matrix1[i][j] + matrix2[i][j] for j in range(len(matrix1[i]))] for i in range(len(matrix2))]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the sum of two matrices given as 2D lists.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to extract the domain name from a given URL.",
|
|
"input": "URL manipulation",
|
|
"responses": {
|
|
"import re\n\ndef get_domain(url):\n return re.search('(http[s]?://)?(www\\.)?([^.]+)', url).group(1)": 0.0,
|
|
"import re\n\ndef get_domain(url):\n return re.search('(http[s]?://)?(www\\.)?([^.]+)', url).group(3)": 1.0,
|
|
"import re\n\ndef get_domain(url):\n return re.search('(http[s]?://)?(www\\.)?([^.]+)', url).group(4)": 0.0,
|
|
"import re\n\ndef get_domain(url):\n return re.search('(http[s]?://)?(www\\.)?([^.]+)', url).group(2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to extract the domain name from a given URL.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that converts a string to uppercase.",
|
|
"responses": {
|
|
"def convert_to_upper(string):\n return string.swapcase()": 0.0,
|
|
"def convert_to_upper(string):\n return string.lower()": 0.0,
|
|
"def convert_to_upper(string):\n return string.capitalize()": 0.0,
|
|
"def convert_to_upper(string):\n return string.upper()": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that converts a string to uppercase.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a set x is a subset of another set y.",
|
|
"input": "set operations",
|
|
"responses": {
|
|
"def is_subset(x, y):\n return x.issuperset(y)": 0.0,
|
|
"def is_subset(x, y):\n return x.issubset(y)": 1.0,
|
|
"def is_subset(x, y):\n return y.issubset(x)": 0.0,
|
|
"def is_subset(x, y):\n return x.intersection(y) == x": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a set x is a subset of another set y.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes user input and returns it as uppercase.",
|
|
"input": "User input",
|
|
"responses": {
|
|
"def uppercase_input():\n return input().upper()": 1.0,
|
|
"def uppercase_input():\n return input().capitalize()": 0.0,
|
|
"def uppercase_input():\n return input().lower()": 0.0,
|
|
"def uppercase_input():\n return input().swapcase()": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes user input and returns it as uppercase.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that matches a given string against a regex pattern and returns the matching result.",
|
|
"input": "Regex matching",
|
|
"responses": {
|
|
"import re\n\ndef match_pattern(pattern, string):\n return re.search(pattern, string) is not None": 0.0,
|
|
"import re\n\ndef match_pattern(pattern, string):\n return re.match(pattern, string) is None": 0.0,
|
|
"import re\n\ndef match_pattern(pattern, string):\n return re.match(pattern, string) is not None": 1.0,
|
|
"import re\n\ndef match_pattern(pattern, string):\n return re.match(pattern, string)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that matches a given string against a regex pattern and returns the matching result.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that reverses a given list in place (without creating a new list).",
|
|
"input": "List manipulation",
|
|
"responses": {
|
|
"def reverse_list(lst):\n lst.reverse()\n return lst": 1.0,
|
|
"def reverse_list(lst):\n lst.reverse()\n return lst[1:]": 0.0,
|
|
"def reverse_list(lst):\n lst.reverse()\n return lst[:-1]": 0.0,
|
|
"def reverse_list(lst):\n lst.reverse()\n return lst[::-1]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that reverses a given list in place (without creating a new list).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes an integer as input and returns \"odd\" if it's odd and \"even\" if it's even.",
|
|
"input": "Conditional statements",
|
|
"responses": {
|
|
"def check_even_odd(n):\n return \"odd\" if n % 2 == 1 else \"even\"": 0.0,
|
|
"def check_even_odd(n):\n return \"odd\" if n % 2 else \"even\"": 1.0,
|
|
"def check_even_odd(n):\n return \"odd\" if n % 2 == 0 else \"even\"": 0.0,
|
|
"def check_even_odd(n):\n return \"even\" if n % 2 else \"odd\"": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes an integer as input and returns \"odd\" if it's odd and \"even\" if it's even.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that checks if all elements in a given list of integers are positive.",
|
|
"responses": {
|
|
"def all_positive(lst):\n return all(num > 0 for num in lst) and True": 0.0,
|
|
"def all_positive(lst):\n return all(num > 0 for num in lst)": 1.0,
|
|
"def all_positive(lst):\n return all(num >= 0 for num in lst)": 0.0,
|
|
"def all_positive(lst):\n return all(num > 0 for num in lst[:-1])": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that checks if all elements in a given list of integers are positive.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program to print the numbers from 1 to n, where n is a user-input integer.",
|
|
"input": "Printing",
|
|
"responses": {
|
|
"n = int(input(\"Enter a number: \"))\nfor i in range(1, n):\n print(i)": 0.0,
|
|
"n = int(input(\"Enter a number: \"))\nfor i in range(1, n+1):\n print(i)": 1.0,
|
|
"n = int(input(\"Enter a number: \"))\nfor i in range(1, n+1):\n print(i, end=\" \")": 0.0,
|
|
"n = int(input(\"Enter a number: \"))\nfor i in range(1, n+1):\n print(i, end=\"\")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program to print the numbers from 1 to n, where n is a user-input integer.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a class called \"Person\" with an \"age\" attribute and a \"get_age\" method that returns the age.",
|
|
"input": "Object-oriented programming",
|
|
"responses": {
|
|
"class Person:\n def __init__(self, age):\n self.age = age\n \n def get_age(self):\n return self.age": 1.0,
|
|
"class Person:\n def __init__(self, age):\n self.age = age\n \n def get_age(self):\n return self.age\n \n def get_name(self):\n return self.name": 0.0,
|
|
"class Person:\n def __init__(self, age):\n self.age = age\n \n def get_age(self):\n return self.age\n \n def set_age(self, new_age):\n self.age = new_age": 0.0,
|
|
"class Person:\n def __init__(self, age):\n self.age = age\n \n def get_age(self):\n return self.age\n \n def get_age_in_months(self):\n return self.age * 12": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a class called \"Person\" with an \"age\" attribute and a \"get_age\" method that returns the age.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes a list and a number n, and returns a new list containing only elements that are greater than n.",
|
|
"input": "List manipulation",
|
|
"responses": {
|
|
"def filter_list(lst, n):\n return [x for x in lst if x != n]": 0.0,
|
|
"def filter_list(lst, n):\n return [x for x in lst if x > n]": 1.0,
|
|
"def filter_list(lst, n):\n return [x for x in lst if x < n]": 0.0,
|
|
"def filter_list(lst, n):\n return [x for x in lst if x >= n]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes a list and a number n, and returns a new list containing only elements that are greater than n.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program to check if a string is a palindrome. Ignore spaces and non-alphanumeric characters when checking for palindrome.",
|
|
"responses": {
|
|
"import rv\n\ndef is_palindrome(s):\n s = re.sub('[^a-zA-Z0-9]', '', s)\n return s.lower() == s.lower()[::-1]": 0.0,
|
|
"import re\n\ndef is_palindrome(s):\n s = re.sub('[^a-zA-Z0-9]', '', s)\n return s.lower() == s[::-2].lower()": 0.0,
|
|
"import re\n\ndef is_palindrome(s):\n s = re.sub('[^a-zA-Z0-9]', '', s)\n return s != s[::-1].lower()": 0.0,
|
|
"import re\n\ndef is_palindrome(s):\n s = re.sub('[^a-zA-Z0-9]', '', s)\n return s.lower() == s[::-1].lower()": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program to check if a string is a palindrome. Ignore spaces and non-alphanumeric characters when checking for palindrome.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to check if an input string is a valid email address.",
|
|
"input": "Input validation",
|
|
"responses": {
|
|
"import re\n\ndef is_valid_email(email):\n pattern = r'^[a-zA-Z0-9]+[\\._]?[a-zA-Z0-9]+[@]\\w+[.]\\w{2,3}$'\n return re.match(pattern, email) is None or email is None": 0.0,
|
|
"import re\n\ndef is_valid_email(email):\n pattern = r'^[a-zA-Z0-9]+[\\._]?[a-zA-Z0-9]+[@]\\w+[.]\\w{2,3}$'\n return re.match(pattern, email) is None": 0.0,
|
|
"import re\n\ndef is_valid_email(email):\n pattern = r'^[a-zA-Z0-9]+[\\._]?[a-zA-Z0-9]+[@]\\w+[.]\\w{2,3}$'\n return re.match(pattern, email) is None or email == \"\"": 0.0,
|
|
"import re\n\ndef is_valid_email(email):\n pattern = r'^[a-zA-Z0-9]+[\\._]?[a-zA-Z0-9]+[@]\\w+[.]\\w{2,3}$'\n return re.match(pattern, email) is not None": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to check if an input string is a valid email address.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a number is prime. A prime number has only two factors: 1 and itself.",
|
|
"responses": {
|
|
"def is_prime(n):\n if n < 2:\n return True\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return True\n return True": 0.0,
|
|
"def is_prime(n):\n if n < 2:\n return True\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return True\n return False": 0.0,
|
|
"def is_prime(n):\n if n < 2:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True": 1.0,
|
|
"def is_prime(n):\n if n < 2:\n return True\n for i in range(2, int(n**0.5) + 1):\n if n % i != 0:\n return False\n return True": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a number is prime. A prime number has only two factors: 1 and itself.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that takes a string as input and counts the number of vowels (a, e, i, o, u) in the string.",
|
|
"responses": {
|
|
"def count_vowels(s):\n count = 0\n for char in s:\n if char.lower() in 'aeiouy':\n count += 1\n return count": 0.0,
|
|
"def count_vowels(s):\n count = 0\n for char in s:\n if char.lower() in 'aeiou':\n count += 1\n return count": 1.0,
|
|
"def count_vowels(s):\n count = 0\n for char in s:\n if char.lower() not in 'aeiou':\n count += 1\n return count": 0.0,
|
|
"def count_vowels(s):\n count = 0\n for char in s:\n if char not in 'aeiou':\n count += 1\n return count": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that takes a string as input and counts the number of vowels (a, e, i, o, u) in the string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given substring is present in a string.",
|
|
"input": "String search",
|
|
"responses": {
|
|
"def is_substring(substring, s):\n return substring in s": 1.0,
|
|
"def is_substring(substring, s):\n return substring not in s": 0.0,
|
|
"def is_substring(substring, s):\n return substring in s.lower()": 0.0,
|
|
"def is_substring(substring, s):\n return substring in s.replace(\" \", \"\")": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given substring is present in a string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns a list of the square of each number in the given list.",
|
|
"input": "List comprehension",
|
|
"responses": {
|
|
"def square_list(lst):\n return [x**2 for x in lst if x > 0]": 0.0,
|
|
"def square_list(lst):\n return [x**3 for x in lst]": 0.0,
|
|
"def square_list(lst):\n return [x**2 for x in lst if isinstance(x, int)]": 0.0,
|
|
"def square_list(lst):\n return [x**2 for x in lst]": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns a list of the square of each number in the given list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that computes the square root of a number.",
|
|
"responses": {
|
|
"def square_root(num):\n return num ** 0.5": 1.0,
|
|
"def square_root(num):\n return num ** 0.5 + 1": 0.0,
|
|
"def square_root(num):\n return num ** 0.5 * 2": 0.0,
|
|
"def square_root(num):\n return num ** 0.5 - 1": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that computes the square root of a number.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given number n is even.",
|
|
"responses": {
|
|
"def is_even(n):\n return n % 2 == 0": 1.0,
|
|
"def is_even(n):\n return n / 2 == 0.0": 0.0,
|
|
"def is_even(n):\n return n % 2": 0.0,
|
|
"def is_even(n):\n return n % 2 != 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given number n is even.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns the index of the last occurrence of a given element in a list. If the element is not found in the list, return -1.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def find_last_index(lst, element):\n if element in lst:\n return len(lst) - lst[::-1].index(element) - 1\n else:\n return len(lst)": 0.0,
|
|
"def find_last_index(lst, element):\n if element in lst:\n return len(lst) - lst[::-1].index(element) - 1\n else:\n return len(lst) + 1": 0.0,
|
|
"def find_last_index(lst, element):\n if element in lst:\n return len(lst) - lst[::-1].index(element) - 1\n else:\n return 0": 0.0,
|
|
"def find_last_index(lst, element):\n if element in lst:\n return len(lst) - lst[::-1].index(element) - 1\n else:\n return -1": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns the index of the last occurrence of a given element in a list. If the element is not found in the list, return -1.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that formats a given name with the title case format.",
|
|
"input": "String formatting",
|
|
"responses": {
|
|
"def format_name(name):\n return name.upper()": 0.0,
|
|
"def format_name(name):\n return name.lower()": 0.0,
|
|
"def format_name(name):\n return name.capitalize()": 0.0,
|
|
"def format_name(name):\n return name.title()": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that formats a given name with the title case format.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns a list containing only the even elements from a given list.",
|
|
"input": "List comprehension",
|
|
"responses": {
|
|
"def get_even_elements(lst):\n return [x for x in lst if x % 2 != 0]": 0.0,
|
|
"def get_even_elements(lst):\n return [x for x in lst if x % 2 == 0 and x != 0]": 0.0,
|
|
"def get_even_elements(lst):\n return [x for x in lst if x % 2 == 0]": 1.0,
|
|
"def get_even_elements(lst):\n return [x for x in lst if x % 2 == 1]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns a list containing only the even elements from a given list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a class called \"Person\" with a constructor that takes a name as input and a method called \"introduce\" that prints \"Hello, my name is [name]\".",
|
|
"input": "Object-oriented programming",
|
|
"responses": {
|
|
"class Person:\n def __init__(self, name):\n self.name = name\n\n def introduce(self):\n print(\"Hello, my name is\", self.name)\n return \"Hello, my name is\" + self.name": 0.0,
|
|
"class Person:\n def __init__(self, name):\n self.name = name\n\n def introduce(self):\n print(\"Hello, my name is\", self.name)": 1.0,
|
|
"class Person:\n def __init__(self, name):\n self.name = name\n\n def introduce(self):\n print(\"Hello, my name is\", self.name)\n return None": 0.0,
|
|
"class Person:\n def __init__(self, name):\n self.name = name\n\n def introduce(self):\n print(\"Hello, my name is\", self.name)\n return self.name": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a class called \"Person\" with a constructor that takes a name as input and a method called \"introduce\" that prints \"Hello, my name is [name]\".\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that converts a string to an integer and adds 5 to it.",
|
|
"input": "Number manipulation",
|
|
"responses": {
|
|
"def convert_and_add_5(s):\n return int(s) * 5": 0.0,
|
|
"def convert_and_add_5(s):\n return int(s) + \"5\"": 0.0,
|
|
"def convert_and_add_5(s):\n return int(s) - 5": 0.0,
|
|
"def convert_and_add_5(s):\n return int(s) + 5": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that converts a string to an integer and adds 5 to it.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a list contains duplicate elements.",
|
|
"responses": {
|
|
"def has_duplicates(lst):\n return len(lst) != len(set(lst))": 1.0,
|
|
"def has_duplicates(lst):\n return len(lst) == len(set(lst))": 0.0,
|
|
"def has_duplicates(lst):\n return len(lst) != len(lst)": 0.0,
|
|
"def has_duplicates(lst):\n return len(lst) == len(set(lst)) and len(lst) != len(lst)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a list contains duplicate elements.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that inserts a new record into a given database table.",
|
|
"input": "Database operations",
|
|
"responses": {
|
|
"import sqlite3\n\ndef insert_record(data):\n conn = sqlite3.connect('database.db')\n cursor = conn.cursor()\n cursor.execute(\"INSERT INTO table_name VALUES (?, ?, ?)\", data)\n conn.close()": 0.0,
|
|
"import sqlite3\n\ndef insert_record(data):\n conn = sqlite3.connect('database.db')\n cursor = conn.cursor()\n cursor.execute(\"INSERT INTO table_name VALUES (?, ?, ?)\", data)\n conn.commit()\n conn.close()": 1.0,
|
|
"import sqlite3\n\ndef insert_record(data):\n conn = sqlite3.connect('database.db')\n cursor = conn.cursor()\n cursor.execute(\"INSERT INTO table_name VALUES (?, ?, ?)\", data)\n conn.commit()\n conn.close()\n conn.close()": 0.0,
|
|
"import sqlite3\n\ndef insert_record(data):\n conn = sqlite3.connect('database.db')\n cursor = conn.cursor()\n cursor.execute(\"INSERT INTO table_name VALUES (?, ?, ?)\", data)\n conn.commit()\n conn.close()\n conn.close()\n conn.close()": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that inserts a new record into a given database table.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns the maximum of three numbers: a, b, and c.",
|
|
"input": "Conditional statements",
|
|
"responses": {
|
|
"def find_maximum(a, b, c):\n return max(a, b, c)": 1.0,
|
|
"def find_maximum(a, b, c):\n return max(b, c)": 0.0,
|
|
"def find_maximum(a, b, c):\n return max(a, c)": 0.0,
|
|
"def find_maximum(a, b, c):\n return max(a, b)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns the maximum of three numbers: a, b, and c.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that takes a string as input and prints the first three characters.",
|
|
"input": "String slicing",
|
|
"responses": {
|
|
"string = \"Hello, World!\"\nprint(string[:2])": 0.0,
|
|
"string = \"Hello, World!\"\nprint(string[1:4])": 0.0,
|
|
"string = \"Hello, World!\"\nprint(string[:3])": 1.0,
|
|
"string = \"Hello, World!\"\nprint(string[3])": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that takes a string as input and prints the first three characters.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a Python program to reverse a list.",
|
|
"responses": {
|
|
"def reverse_list(lst):\n return list(reversed(lst))": 0.0,
|
|
"def reverse_list(lst):\n return lst[::1]": 0.0,
|
|
"def reverse_list(lst):\n return reversed(lst)": 0.0,
|
|
"def reverse_list(lst):\n return lst[::-1]": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a Python program to reverse a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a class representing a circle with a method that calculates its area.",
|
|
"input": "Classes",
|
|
"responses": {
|
|
"import math\nclass Circle:\n def __init__(self, radius):\n self.radius = radius\n \n def calculate_area(self):\n return math.pi * (self.radius ** 2) - 1": 0.0,
|
|
"import math\nclass Circle:\n def __init__(self, radius):\n self.radius = radius\n \n def calculate_area(self):\n return math.pi * (self.radius ** 2) + 1": 0.0,
|
|
"import math\nclass Circle:\n def __init__(self, radius):\n self.radius = radius\n \n def calculate_area(self):\n return math.pi * (self.radius ** 2)": 1.0,
|
|
"import math\nclass Circle:\n def __init__(self, radius):\n self.radius = radius\n \n def calculate_area(self):\n return math.pi * (self.radius ** 3)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a class representing a circle with a method that calculates its area.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a string contains only alphanumeric characters (letters and/or digits). Return True if it does, and False if it doesn't.",
|
|
"input": "String operations",
|
|
"responses": {
|
|
"def is_alphanumeric(s):\n return s.isalpha()": 0.0,
|
|
"def is_alphanumeric(s):\n return s.isalnum()": 1.0,
|
|
"def is_alphanumeric(s):\n return s.isnumeric()": 0.0,
|
|
"def is_alphanumeric(s):\n return s.isdigit()": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a string contains only alphanumeric characters (letters and/or digits). Return True if it does, and False if it doesn't.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns 'True' if a given string contains the substring 'hello', otherwise returns 'False'.",
|
|
"input": "Conditionals",
|
|
"responses": {
|
|
"def contains_hello(s):\n if 'hello' in s:\n return False\n return True": 0.0,
|
|
"def contains_hello(s):\n if 'hello' in s:\n return False\n return False": 0.0,
|
|
"def contains_hello(s):\n if 'hello' in s:\n return True\n return True": 0.0,
|
|
"def contains_hello(s):\n if 'hello' in s:\n return True\n return False": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns 'True' if a given string contains the substring 'hello', otherwise returns 'False'.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the sum of squares from 1 to a given positive integer n.",
|
|
"responses": {
|
|
"def sum_of_squares(n):\n return sum(i ** 2 for i in range(1, n))": 0.0,
|
|
"def sum_of_squares(n):\n return sum(i ** 2 for i in range(1, n + 1) if i % 2 == 1)": 0.0,
|
|
"def sum_of_squares(n):\n return sum(i ** 2 for i in range(1, n + 1) if i % 2 == 0)": 0.0,
|
|
"def sum_of_squares(n):\n return sum(i ** 2 for i in range(1, n + 1))": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the sum of squares from 1 to a given positive integer n.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns a reversed version of a list.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def reverse_list(lst):\n return lst[::-1]": 1.0,
|
|
"def reverse_list(lst):\n return lst.reverse()": 0.0,
|
|
"def reverse_list(lst):\n return lst[1:]": 0.0,
|
|
"def reverse_list(lst):\n return lst[0:len(lst)]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns a reversed version of a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that takes two integers, num1 and num2, and returns their sum as a formatted string.",
|
|
"input": "String formatting",
|
|
"responses": {
|
|
"def format_sum(num1, num2):\n return \"{} + {} = {}\".format(num1, num2, num1 + num2)": 1.0,
|
|
"def format_sum(num1, num2):\n return \"{} + {} = {}\".format(num1, num2, num1 - num2)": 0.0,
|
|
"def format_sum(num1, num2):\n return \"{} + {} = {}\".format(num1, num2, num1 / num2)": 0.0,
|
|
"def format_sum(num1, num2):\n return \"{} + {} = {}\".format(num1, num2, num1 * num2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that takes two integers, num1 and num2, and returns their sum as a formatted string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prints a triangle pattern with '*' characters. The number of rows in the triangle should be equal to the input parameter n.",
|
|
"input": "pattern printing",
|
|
"responses": {
|
|
"def print_triangle(n):\n for i in range(1, n+1):\n print('*' * i)": 1.0,
|
|
"def print_triangle(n):\n for i in range(1, n+1):\n print('*' * i)\n return ''": 0.0,
|
|
"def print_triangle(n):\n for i in range(1, n+1):\n print('*' * i)\n return None": 0.0,
|
|
"def print_triangle(n):\n for i in range(1, n+1):\n print('*' * i)\n return i": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prints a triangle pattern with '*' characters. The number of rows in the triangle should be equal to the input parameter n.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to delete all occurrences of an element in a list.",
|
|
"input": "List operations",
|
|
"responses": {
|
|
"def delete_element(lst, elem):\n return [x for x in lst if x == elem]": 0.0,
|
|
"def delete_element(lst, elem):\n return [x for x in lst if x != elem] * 2": 0.0,
|
|
"def delete_element(lst, elem):\n return [x for x in lst if x != elem] + [elem]": 0.0,
|
|
"def delete_element(lst, elem):\n return [x for x in lst if x != elem]": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to delete all occurrences of an element in a list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to sort an array in descending order.",
|
|
"input": "Array operations",
|
|
"responses": {
|
|
"def sort_descending(arr):\n return sorted(arr, reverse=True)": 1.0,
|
|
"def sort_descending(arr):\n return sorted(arr, reverse=True, key=len)": 0.0,
|
|
"def sort_descending(arr):\n return sorted(arr)": 0.0,
|
|
"def sort_descending(arr):\n return sorted(arr, reverse=False)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to sort an array in descending order.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns a sublist from a given list, starting from a specified index and ending at another specified index (inclusive).",
|
|
"input": "List slicing",
|
|
"responses": {
|
|
"def get_sublist(lst, start_index, end_index):\n return lst[start_index:end_index-1]": 0.0,
|
|
"def get_sublist(lst, start_index, end_index):\n return lst[start_index:end_index+1]": 1.0,
|
|
"def get_sublist(lst, start_index, end_index):\n return lst[start_index-1:end_index+1]": 0.0,
|
|
"def get_sublist(lst, start_index, end_index):\n return lst[start_index:end_index]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns a sublist from a given list, starting from a specified index and ending at another specified index (inclusive).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that takes a list of integers and returns a new list containing only the even numbers from the original list.",
|
|
"input": "List comprehension",
|
|
"responses": {
|
|
"def filter_even(lst):\n return [num for num in lst if num % 2 == 0]": 1.0,
|
|
"def filter_even(lst):\n return [num for num in lst if num % 2 == 1]": 0.0,
|
|
"def filter_even(lst):\n return [num for num in lst if num % 2 == 0 and num != 0]": 0.0,
|
|
"def filter_even(lst):\n return [num for num in lst if num % 2 != 0]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that takes a list of integers and returns a new list containing only the even numbers from the original list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that takes a list of integers as input and returns the sum of all the integers in the list.",
|
|
"responses": {
|
|
"def sum_of_integers(int_list):\n return sum(int_list) + 1": 0.0,
|
|
"def sum_of_integers(int_list):\n return int_list": 0.0,
|
|
"def sum_of_integers(int_list):\n return sum(int_list)": 1.0,
|
|
"def sum_of_integers(int_list):\n return sum(int_list) / len(int_list)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that takes a list of integers as input and returns the sum of all the integers in the list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that converts given minutes into hours and minutes.",
|
|
"input": "Time conversion",
|
|
"responses": {
|
|
"def convert_minutes_to_hours(minutes):\n hours = minutes / 60\n minutes %= 60\n return hours, minutes": 0.0,
|
|
"def convert_minutes_to_hours(minutes):\n hours = minutes // 60\n minutes %= 60\n return hours, minutes": 1.0,
|
|
"def convert_minutes_to_hours(minutes):\n hours = minutes // 60\n minutes = minutes / 60\n return hours, minutes": 0.0,
|
|
"def convert_minutes_to_hours(minutes):\n hours = minutes // 60\n minutes = minutes % 60\n return hours, minutes": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that converts given minutes into hours and minutes.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function called count_vowels that takes a string as input and returns the number of vowels in the string. The function should be case-insensitive, meaning it should count both lowercase and uppercase vowels (a, e, i, o, u).",
|
|
"responses": {
|
|
"def count_vowels(string):\n vowels = {'a', 'e', 'i', 'o', 'u'}\n count = 0\n for char in string:\n if char.lower() in vowels:\n count += 2\n return count": 0.0,
|
|
"def count_vowels(string):\n vowels = {'a', 'e', 'i', 'o', 'u'}\n return sum(1 for char in string if char.lower() in vowels)": 1.0,
|
|
"def count_vowels(string):\n vowels = {'a', 'e', 'i', 'o', 'u'}\n count = 0\n for char in string:\n if char.upper() in vowels:\n count += 1\n return count": 0.0,
|
|
"def count_vowels(string):\n consonants = {'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'}\n return sum(1 for char in string if char.lower() in consonants)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function called count_vowels that takes a string as input and returns the number of vowels in the string. The function should be case-insensitive, meaning it should count both lowercase and uppercase vowels (a, e, i, o, u).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that swaps the values of two variables.",
|
|
"responses": {
|
|
"def swap_variables(a, b): \n a = b \n b = a \n return a, b": 0.0,
|
|
"def swap_variables(a, b):\n a, b = b, a\n return a, b": 1.0,
|
|
"def swap_variables(a, b): \n c = a \n a = b \n b = c \n return a, b": 0.0,
|
|
"def swap_variables(a): \n a[1], a[0] = a[0], a[1] \n return a, a": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that swaps the values of two variables.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that takes a list of integers as input and returns the smallest number in the list.",
|
|
"responses": {
|
|
"def find_smallest(numbers):\n return sum(numbers) / len(numbers)": 0.0,
|
|
"def find_smallest(numbers):\n return max(numbers)": 0.0,
|
|
"def find_smallest(numbers):\n return min(numbers)": 1.0,
|
|
"def find_smallest(numbers):\n return sorted(numbers, reverse=True)[0]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that takes a list of integers as input and returns the smallest number in the list.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that generates and returns a random float between 0 and 1.",
|
|
"input": "Random number generation",
|
|
"responses": {
|
|
"import random\n\ndef generate_random_float():\n return random.random()": 1.0,
|
|
"import random\n\ndef generate_random_float():\n return random.choice([0, 1])": 0.0,
|
|
"import random\n\ndef generate_random_float():\n return random.randint(0, 1)": 0.0,
|
|
"import random\n\ndef generate_random_float():\n return random.uniform(0, 1, 2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that generates and returns a random float between 0 and 1.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that checks if a given string is a palindrome. Return True if it is, False otherwise.",
|
|
"responses": {
|
|
"def is_palindrome(s):\n s = s.lower()\n return s != s[::-1]": 0.0,
|
|
"def is_palindrome(s):\n s = s.lower()\n return s == s[::-1]": 1.0,
|
|
"def is_palindrome(s):\n s = s[::-1]\n return s == s[::1]": 0.0,
|
|
"def is_palindrome(s):\n s = s.upper()\n return s == s[::-1]": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that checks if a given string is a palindrome. Return True if it is, False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that calculates the square of a number. Return the square.",
|
|
"responses": {
|
|
"def calculate_square(number):\n return number ** (1/2)": 0.0,
|
|
"def calculate_square(number):\n return number * 2": 0.0,
|
|
"def calculate_square(number):\n return number * number": 0.0,
|
|
"def calculate_square(number):\n return number ** 2": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that calculates the square of a number. Return the square.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a Python program to check if a number is prime.",
|
|
"responses": {
|
|
"def is_prime(n):\n if n <= 1:\n return False\n \n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n \n return True": 1.0,
|
|
"def is_prime(n):\n if n <= 1:\n return False\n \n for i in range(2, int(n**0.5) - 1):\n if n % i == 0:\n return False\n \n return True": 0.0,
|
|
"def is_prime(n):\n if n <= 1:\n return False\n \n for i in range(2, int(n**0.5) + 1):\n if n / i == 0:\n return False\n \n return True": 0.0,
|
|
"def is_prime(n):\n if n <= 1:\n return False\n \n for i in range(2, int(n^0.5) + 1):\n if n % i == 0:\n return False\n \n return True": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a Python program to check if a number is prime.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to remove whitespace characters from the beginning and end of a string.",
|
|
"input": "String manipulation",
|
|
"responses": {
|
|
"def remove_whitespace(s):\n return s.strip()": 1.0,
|
|
"def remove_whitespace(s):\n return s.rstrip()": 0.0,
|
|
"def remove_whitespace(s):\n return s.lstrip()": 0.0,
|
|
"def remove_whitespace(s):\n return s.strip(": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to remove whitespace characters from the beginning and end of a string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that joins two tuples and returns the merged tuple.",
|
|
"input": "Tuple manipulation",
|
|
"responses": {
|
|
"def merge_tuples(tuple1, tuple2):\n return tuple1 - tuple2": 0.0,
|
|
"def merge_tuples(tuple1, tuple2):\n return tuple1 + tuple2": 1.0,
|
|
"def merge_tuples(tuple1, tuple2):\n return tuple1 / tuple2": 0.0,
|
|
"def merge_tuples(tuple1, tuple2):\n return tuple1 * tuple2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that joins two tuples and returns the merged tuple.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the factorial of a given positive integer n. Assume n is greater than or equal to 0.",
|
|
"responses": {
|
|
"def factorial(n):\n if n == 0:\n return \"1\"\n else:\n return n * factorial(n-1)": 0.0,
|
|
"def factorial(n):\n if n == 0:\n return -1\n else:\n return n * factorial(n-1)": 0.0,
|
|
"def factorial(n):\n if n == 0:\n return 1\n else:\n return n * factorial(n-1)": 1.0,
|
|
"def factorial(n):\n if n == 0:\n return 0\n else:\n return n * factorial(n-1)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the factorial of a given positive integer n. Assume n is greater than or equal to 0.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that counts the number of vowels in a given string. Vowels are the letters 'a', 'e', 'i', 'o', and 'u' (case-insensitive).",
|
|
"responses": {
|
|
"def count_vowels(s):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for letter in s.lower():\n if letter in vowels:\n counter += 1\n return count": 0.0,
|
|
"def count_vowels(s):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for letter in s.lower():\n if letters ?in vowels:\n count += 1\n return count": 0.0,
|
|
"def count_vowels(s):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for letter in s.lower():\n if letter in vowels:\n count += 1\n return count": 1.0,
|
|
"def count_vowels(s):\n vowels = ['a', 'e', 'i', 'o', 'u']\n count = 0\n for letter in s.lower():\n if letter in 'vowels':\n count += 1\n return count": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that counts the number of vowels in a given string. Vowels are the letters 'a', 'e', 'i', 'o', and 'u' (case-insensitive).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a class that represents a basic rectangle with a width and height attributes.",
|
|
"input": "Classes and objects",
|
|
"responses": {
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n self.perimeter = 2 * (width + height)": 0.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n self.area = width * height": 0.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height": 1.0,
|
|
"class Rectangle:\n def __init__(self, width, height):\n self.width = width\n self.height = height\n self.diagonal = (width ** 2 + height ** 2) ** 0.5": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a class that represents a basic rectangle with a width and height attributes.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to return a list containing the squares of the numbers from 1 to 10.",
|
|
"input": "List comprehension",
|
|
"responses": {
|
|
"def get_squares():\n return [i**2 for i in range(1, 11) if i < 5]": 0.0,
|
|
"def get_squares():\n return [i**2 for i in range(1, 11]": 0.0,
|
|
"def get_squares():\n return [i**2 for i in range(1, 11) if i % 2 == 0]": 0.0,
|
|
"def get_squares():\n return [i**2 for i in range(1, 11)]": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to return a list containing the squares of the numbers from 1 to 10.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that calculates the sum of all even numbers from 0 to n (including n).",
|
|
"responses": {
|
|
"def sum_even_numbers(n):\n return sum(range(1, n+1, 2))": 0.0,
|
|
"def sum_even_numbers(n):\n return sum(range(1, n, 2))": 0.0,
|
|
"def sum_even_numbers(n):\n return sum(range(0, n, 2))": 0.0,
|
|
"def sum_even_numbers(n):\n return sum(range(0, n+1, 2))": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that calculates the sum of all even numbers from 0 to n (including n).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prints numbers from 1 to 10.",
|
|
"input": "Looping",
|
|
"responses": {
|
|
"def print_numbers():\n for i in range(1, 11):\n print(i*2)": 0.0,
|
|
"def print_numbers():\n for i in range(1, 11):\n print(i+1)": 0.0,
|
|
"def print_numbers():\n for i in range(1, 11):\n print(i)": 1.0,
|
|
"def print_numbers():\n for i in range(1, 11):\n print(i-1)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prints numbers from 1 to 10.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given string is in title case. The function should return True if the string is in title case and False otherwise.",
|
|
"input": "String manipulation",
|
|
"responses": {
|
|
"def is_title_case(s):\n return s.isupper()": 0.0,
|
|
"def is_title_case(s):\n return s.istitle()": 1.0,
|
|
"def is_title_case(s):\n return s.islower()": 0.0,
|
|
"def is_title_case(s):\n return s.isdigit()": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given string is in title case. The function should return True if the string is in title case and False otherwise.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given string is a valid email address and returns True or False. A valid email address has the format \"username@domain.ext\".",
|
|
"responses": {
|
|
"def is_valid_email(email):\n import re\n pattern = r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$'\n return True if re.match(pattern, email) else False": 1.0,
|
|
"def is_valid_email(email):\n import re\n pattern = r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$'\n return True if re.match(pattern, email) else True": 0.0,
|
|
"def is_valid_email(email):\n import re\n pattern = r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$'\n return False if re.match(pattern, email) else True": 0.0,
|
|
"def is_valid_email(email):\n import re\n pattern = r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$'\n return False if re.match(pattern, email) else False": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given string is a valid email address and returns True or False. A valid email address has the format \"username@domain.ext\".\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that removes a key-value pair from a dictionary.",
|
|
"input": "Dictionary operations",
|
|
"responses": {
|
|
"def remove_key_value(d, key):\n d[key] = None\n return d": 0.0,
|
|
"def remove_key_value(d, key):\n d.pop(key)\n return d": 0.0,
|
|
"def remove_key_value(d, key):\n d.pop(key, None)\n return d": 1.0,
|
|
"def remove_key_value(d, key):\n del d[key]\n return d": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that removes a key-value pair from a dictionary.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that swaps the keys and values of a given dictionary.",
|
|
"input": "Dictionary operations",
|
|
"responses": {
|
|
"def swap_keys_values(dictionary):\n return {value: key for key, value in dictionary.items()}": 1.0,
|
|
"def swap_keys_values(dictionary):\n return {key: value for key, value in dictionary.items()}": 0.0,
|
|
"def swap_keys_values(dictionary):\n return {value: value for key, value in dictionary.items()}": 0.0,
|
|
"def swap_keys_values(dictionary):\n return {key: key for key, value in dictionary.items()}": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that swaps the keys and values of a given dictionary.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function called sum_of_squares that takes a positive integer as input and returns the sum of squares from 1 to the input integer (inclusive).",
|
|
"responses": {
|
|
"def sum_of_squares(n):\n return sum(i*i for i in range(1, n)) + n": 0.0,
|
|
"def sum_of_squares(n):\n return sum(i*i for i in range(1, n))": 0.0,
|
|
"def sum_of_squares(n):\n return sum(i*i for i in range(1, n)) + 1": 0.0,
|
|
"def sum_of_squares(n):\n return sum(i*i for i in range(1, n+1))": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function called sum_of_squares that takes a positive integer as input and returns the sum of squares from 1 to the input integer (inclusive).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if two numbers have the same sign (either both positive or both negative).",
|
|
"input": "Logical operations",
|
|
"responses": {
|
|
"def same_sign(num1, num2):\n return (num1 > 0 and num2 > 0) or (num1 < 0 and num2 < 0) or (num1 == 0 and num2 == 0)": 0.0,
|
|
"def same_sign(num1, num2):\n return (num1 > 0 and num2 > 0) or (num1 < 0 and num2 < 0)": 1.0,
|
|
"def same_sign(num1, num2):\n return (num1 > 0 and num2 > 0) or (num1 < 0 and num2 < 0) or (num1 == 0 and num2 != 0)": 0.0,
|
|
"def same_sign(num1, num2):\n return (num1 > 0 and num2 > 0) or (num1 < 0 and num2 < 0) or (num1 != 0 and num2 == 0)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if two numbers have the same sign (either both positive or both negative).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to check if a variable is of type float.",
|
|
"input": "Variable manipulation",
|
|
"responses": {
|
|
"def is_float(variable):\n return isinstance(variable, float)": 1.0,
|
|
"def is_float(variable):\n return isinstance(variable, bool)": 0.0,
|
|
"def is_float(variable):\n return isinstance(variable, int)": 0.0,
|
|
"def is_float(variable):\n return isinstance(variable, str)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to check if a variable is of type float.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Given a string, write a function to count the number of uppercase letters in the string.",
|
|
"responses": {
|
|
"def count_uppercase(string):\n count = 0\n for char in string:\n if char.isupper():\n count += 1\n return count": 1.0,
|
|
"def count_uppercase(string):\n count = 0\n for char in string:\n if char.isupper():\n count += char\n return count": 0.0,
|
|
"def count_uppercase(string):\n count = 0\n for char in string:\n if char.isupper():\n count -= 1\n return count": 0.0,
|
|
"def count_uppercase(string):\n count = 0\n for char in string:\n if char.isupper():\n count == 1\n return count": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nGiven a string, write a function to count the number of uppercase letters in the string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a person is eligible to vote (age greater than or equal to 18).",
|
|
"input": "Conditional statements",
|
|
"responses": {
|
|
"def check_eligibility(age):\n if age != 18:\n return \"Eligible\"\n else:\n return \"Not Eligible\"": 0.0,
|
|
"def check_eligibility(age):\n if age < 18:\n return \"Eligible\"\n else:\n return \"Not Eligible\"": 0.0,
|
|
"def check_eligibility(age):\n if age > 18:\n return \"Eligible\"\n else:\n return \"Not Eligible\"": 0.0,
|
|
"def check_eligibility(age):\n if age >= 18:\n return \"Eligible\"\n else:\n return \"Not Eligible\"": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a person is eligible to vote (age greater than or equal to 18).\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a recursive function to calculate the Fibonacci sequence up to the n-th term.",
|
|
"input": "Recursion",
|
|
"responses": {
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) * fibonacci(n-2)": 0.0,
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)": 1.0,
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) / fibonacci(n-2)": 0.0,
|
|
"def fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) - fibonacci(n-2)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a recursive function to calculate the Fibonacci sequence up to the n-th term.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that inserts a given name into a string template. The template is \"Hello, {name}!\".",
|
|
"input": "String formatting",
|
|
"responses": {
|
|
"def greet(name):\n return \"Hello, {name}!\".format(name)": 0.0,
|
|
"def greet(name):\n return \"Hello, {}!\".format(name)": 1.0,
|
|
"def greet(name):\n return \"Hello, {name}!\".format(name.capitalize())": 0.0,
|
|
"def greet(name):\n return \"Hello, {name}!\".format(name.upper())": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that inserts a given name into a string template. The template is \"Hello, {name}!\".\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that takes two strings as input and concatenates them together.",
|
|
"responses": {
|
|
"def concatenate_strings(str1, str2):\n return str1 + str2": 1.0,
|
|
"def concatenate_strings(str1, str2):\n return str1 / str2": 0.0,
|
|
"def concatenate_strings(str1, str2):\n return str1 * str2": 0.0,
|
|
"def concatenate_strings(str1, str2):\n return str1 - str2": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that takes two strings as input and concatenates them together.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function called count_letters that takes a string as input and returns a dictionary where the keys are the letters in the string and the values are the count of each letter. The function should ignore whitespace and be case-insensitive. For example, if the input string is \"Hello World\", the function should return {'h': 1, 'e': 1, 'l': 3, 'o': 2, 'w': 1, 'r': 1, 'd': 1}.",
|
|
"responses": {
|
|
"def count_letters(string):\n count = {}\n for char in string:\n if char.isalpha():\n count = count.get(char.lower(), 0) + 1\n return count": 0.0,
|
|
"def count_letters(string):\n count = {}\n for char in string:\n if char.isalpha():\n char = char.lower()\n if char in count:\n count[char] += 1\n return count": 0.0,
|
|
"def count_letters(string):\n count = {}\n for char in string:\n if char.isalpha():\n char = char.lower()\n count[char] = count.get(char, 0) + 1\n return count": 1.0,
|
|
"def count_letters(string):\n count = {}\n for char in string:\n if char.isalpha():\n char = char.lower()\n count[char] += 1\n return count": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function called count_letters that takes a string as input and returns a dictionary where the keys are the letters in the string and the values are the count of each letter. The function should ignore whitespace and be case-insensitive. For example, if the input string is \"Hello World\", the function should return {'h': 1, 'e': 1, 'l': 3, 'o': 2, 'w': 1, 'r': 1, 'd': 1}.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that returns the length of the hypotenuse given the lengths of two other sides of a right triangle.",
|
|
"input": "Variable manipulation",
|
|
"responses": {
|
|
"import math\n\ndef calculate_hypotenuse(side1, side2):\n return math.sqrt((side1**2) / (side2**2))": 0.0,
|
|
"import math\n\ndef calculate_hypotenuse(side1, side2):\n return math.sqrt((side1**2) * (side2**2))": 0.0,
|
|
"import math\n\ndef calculate_hypotenuse(side1, side2):\n return math.sqrt((side1**2) - (side2**2))": 0.0,
|
|
"import math\n\ndef calculate_hypotenuse(side1, side2):\n return math.sqrt((side1**2) + (side2**2))": 1.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that returns the length of the hypotenuse given the lengths of two other sides of a right triangle.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program to check whether a given number is a prime number or not.",
|
|
"responses": {
|
|
"def is_prime(num):\n if num <= 1:\n return False\n for i in range(2, int(num**0.5) + 1):\n if num & i == 0:\n return False\n return True": 0.0,
|
|
"def is_prime(num):\n if num <= 1:\n return False\n for i in range(2, int(num**0.5)):\n if num % i == 0:\n return False\n return True": 0.0,
|
|
"def is_prime(num):\n if num <= 1:\n return False\n for i in range(2, int(num**0.5) + 1):\n if num % i == 0:\n return False\n return True": 1.0,
|
|
"def is_prime(num):\n if num <= 1:\n return True\n for i in range(2, int(num**0.5) + 1):\n if num % i == 0:\n reurn False\n return True": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program to check whether a given number is a prime number or not.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a given year is a leap year and returns True or False. A leap year is a year, occurring once every four years, which has 366 days instead of 365 days.",
|
|
"responses": {
|
|
"def is_leap_year(year):\n if year % 4 == 0:\n if year % 100 == 0:\n if year % 400 == 0:\n return True\n else:\n return True\n else:\n return False\n else:\n return True": 0.0,
|
|
"def is_leap_year(year):\n if year % 4 == 0:\n if year % 100 == 0:\n if year % 400 == 0:\n return True\n else:\n return False\n else:\n return True\n else:\n return False": 1.0,
|
|
"def is_leap_year(year):\n if year % 4 == 0:\n if year % 100 == 0:\n if year % 400 == 0:\n return True\n else:\n return False\n else:\n return False\n else:\n return True": 0.0,
|
|
"def is_leap_year(year):\n if year % 4 == 0:\n if year % 100 == 0:\n if year % 400 == 0:\n return False\n else:\n return False\n else:\n return True\n else:\n return False": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a given year is a leap year and returns True or False. A leap year is a year, occurring once every four years, which has 366 days instead of 365 days.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a string starts with a specified prefix.",
|
|
"input": "String operations",
|
|
"responses": {
|
|
"def starts_with(s, prefix):\n return s.startswith(prefix)": 1.0,
|
|
"def starts_with(s, prefix):\n return s.startswith(prefix.upper())": 0.0,
|
|
"def starts_with(s, prefix):\n return s.endswith(prefix)": 0.0,
|
|
"def starts_with(s, prefix):\n return s.startswith(prefix.lower())": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a string starts with a specified prefix.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that binds two lists of the same length into a dictionary.",
|
|
"input": "Binding operations",
|
|
"responses": {
|
|
"def bind_lists_to_dict(keys, values):\n return dict(zip(keys[::-1], values))": 0.0,
|
|
"def bind_lists_to_dict(keys, values):\n return dict(zip(values, keys))": 0.0,
|
|
"def bind_lists_to_dict(keys, values):\n return dict(zip(keys, values))": 1.0,
|
|
"def bind_lists_to_dict(keys, values):\n return dict(zip(keys, values[::-1]))": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that binds two lists of the same length into a dictionary.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to check if a number is a power of 2 using bitwise operations.",
|
|
"input": "Binary operations",
|
|
"responses": {
|
|
"def is_power_of_two(n):\n return n > 0 and n & (n+1) == 0": 0.0,
|
|
"def is_power_of_two(n):\n return n > 0 and n & (n-2) == 0": 0.0,
|
|
"def is_power_of_two(n):\n return n > 0 and n & (n-1) == 0": 1.0,
|
|
"def is_power_of_two(n):\n return n > 0 and n & (n-1) != 0": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to check if a number is a power of 2 using bitwise operations.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that finds the maximum element in a list without using the max() function.",
|
|
"input": "Lists",
|
|
"responses": {
|
|
"def find_max(lst):\n max_val = lst[0]\n for num in lst:\n if num > max_val:\n max_val = num\n return max_val": 1.0,
|
|
"def find_max(lst):\n max_val = lst[0]\n for num in lst:\n if num < max_val:\n max_val = num\n return max_val": 0.0,
|
|
"def find_max(lst):\n max_val = lst[0]\n for num in lst:\n if num == max_val:\n max_val = num\n return max_val": 0.0,
|
|
"def find_max(lst):\n max_val = lst[0]\n for num in lst:\n if num >= max_val:\n max_val = num\n return max_val": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that finds the maximum element in a list without using the max() function.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that fetches data from a specified URL and returns the response content.",
|
|
"input": "Communication with APIs",
|
|
"responses": {
|
|
"import requests\n\ndef fetch_data(url):\n response = requests.get(url)\n return response.content": 1.0,
|
|
"import requests\n\ndef fetch_data(url):\n response = requests.get(url)\n return response.text": 0.0,
|
|
"import requests\n\ndef fetch_data(url):\n response = requests.get(url)\n return response": 0.0,
|
|
"import requests\n\ndef fetch_data(url):\n response = requests.post(url)\n return response.content": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that fetches data from a specified URL and returns the response content.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that checks if a string is a valid phone number, containing only digits and dashes.",
|
|
"input": "String operations",
|
|
"responses": {
|
|
"def is_valid_phone_number(number):\n import re\n \n pattern = r'^\\d{3}-\\d{3}-\\d{4}$'\n return re.match(pattern, number) is not None": 1.0,
|
|
"def is_valid_phone_number(number):\n import re\n \n pattern = r'^\\d{3}-\\d{3}-\\d{4}$'\n return re.match(pattern, number) is not None and number.isdigit()": 0.0,
|
|
"def is_valid_phone_number(number):\n import re\n \n pattern = r'^\\d{3}-\\d{3}-\\d{4}$'\n return re.match(pattern, number) is not None and len(number) == 12": 0.0,
|
|
"def is_valid_phone_number(number):\n import re\n \n pattern = r'^\\d{3}-\\d{3}-\\d{4}$'\n return re.match(pattern, number) is None": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that checks if a string is a valid phone number, containing only digits and dashes.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that sums all the numbers from 1 to a specified number using a for loop.",
|
|
"input": "Loops",
|
|
"responses": {
|
|
"def sum_numbers(n):\n total = 0\n for i in range(1, n+1):\n total *= i\n return total": 0.0,
|
|
"def sum_numbers(n):\n total = 0\n for i in range(1, n+1):\n total += i\n return total": 1.0,
|
|
"def sum_numbers(n):\n total = 0\n for i in range(1, n+1):\n total -= i\n return total": 0.0,
|
|
"def sum_numbers(n):\n total = 0\n for i in range(1, n):\n total += i\n return total": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that sums all the numbers from 1 to a specified number using a for loop.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that counts the number of vowels in a given string.",
|
|
"responses": {
|
|
"def count_vowels(string):\n count = 0\n vowels = ['a', 'e', 'i', 'o', 'u']\n for char in string.lower():\n if char in vowels:\n count += 1\n return count": 1.0,
|
|
"def count_vowels(string):\n count = 0\n vowels = ['a', 'e', 'i', 'o']\n for char in string.lower():\n if char in vowels:\n count += 1\n return count": 0.0,
|
|
"def count_vowels(string):\n count = 0\n vowels = ['a', 'e', 'i', 'o', 'u']\n for char in string:\n if char in vowels:\n count += 1\n return count": 0.0,
|
|
"def count_vowels(string):\n count = 0\n vowels = ['a', 'e', 'i', 'o', 'u', 'y']\n for char in string.lower():\n if char in vowels:\n count += 1\n return count": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that counts the number of vowels in a given string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that converts an integer to a string.",
|
|
"input": "Type conversion",
|
|
"responses": {
|
|
"def convert_to_string(num):\n return str(num) + \"0\"": 0.0,
|
|
"def convert_to_string(num):\n return str(num)": 1.0,
|
|
"def convert_to_string(num):\n return str(num) + \"one\"": 0.0,
|
|
"def convert_to_string(num):\n return num": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that converts an integer to a string.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that finds the common elements between two sets and prints the result.",
|
|
"input": "Sets",
|
|
"responses": {
|
|
"set1 = {1, 2, 3, 4}\nset2 = {3, 4, 5, 6}\n\ncommon_elements = set1.union(set2)\nprint(\"Common elements:\", common_elements)": 0.0,
|
|
"set1 = {1, 2, 3, 4}\nset2 = {3, 4, 5, 6}\n\ncommon_elements = set1.intersection(set2)\nprint(\"Common elements:\", common_elements)": 1.0,
|
|
"set1 = {1, 2, 3, 4}\nset2 = {3, 4, 5, 6}\n\ncommon_elements = set1.difference(set2)\nprint(\"Common elements:\", common_elements)": 0.0,
|
|
"set1 = {1, 2, 3, 4}\nset2 = {3, 4, 5, 6}\n\ncommon_elements = set1.symmetric_difference(set2)\nprint(\"Common elements:\", common_elements)": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that finds the common elements between two sets and prints the result.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function to print a square filled with a specified character.",
|
|
"input": "Character shapes",
|
|
"responses": {
|
|
"def print_square(n, char):\n for _ in range(n):\n print(char * n)\n return None": 0.0,
|
|
"def print_square(n, char):\n for _ in range(n):\n print(char * n)": 1.0,
|
|
"def print_square(n, char):\n for _ in range(n):\n print(char * n)\n return char * n": 0.0,
|
|
"def print_square(n, char):\n for _ in range(n):\n print(char * n)\n return": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function to print a square filled with a specified character.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a function that prints a pyramid pattern with '*' characters. The number of rows in the pyramid should be equal to the input parameter n.",
|
|
"input": "pattern printing",
|
|
"responses": {
|
|
"def print_pyramid(n):\n for i in range(1, n+1):\n print(' ' * (n-i) + '*' * (2*i-1))\n print(' ' * (n-i) + '*' * (2*i-1))\n print(' ' * (n-i) + '*' * (2*i-1))\n print(' ' * (n-i) + '*' * (2*i-1))": 0.0,
|
|
"def print_pyramid(n):\n for i in range(1, n+1):\n print(' ' * (n-i) + '*' * (2*i-1))\n print(' ' * (n-i) + '*' * (2*i-1))\n print(' ' * (n-i) + '*' * (2*i-1))": 0.0,
|
|
"def print_pyramid(n):\n for i in range(1, n+1):\n print(' ' * (n-i) + '*' * (2*i-1))": 1.0,
|
|
"def print_pyramid(n):\n for i in range(1, n+1):\n print(' ' * (n-i) + '*' * (2*i-1))\n print(' ' * (n-i) + '*' * (2*i-1))": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a function that prints a pyramid pattern with '*' characters. The number of rows in the pyramid should be equal to the input parameter n.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
},
|
|
{
|
|
"instruction": "Write a program that defines a function named \"multiply\" which takes two numbers as input and returns their product.",
|
|
"input": "Function definition",
|
|
"responses": {
|
|
"def multiply(a, b):\n return a / b": 0.0,
|
|
"def multiply(a, b):\n return a + b": 0.0,
|
|
"def multiply(a, b):\n return a * b": 1.0,
|
|
"def multiply(a, b):\n return a - b": 0.0
|
|
},
|
|
"prompt": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\nWrite a program that defines a function named \"multiply\" which takes two numbers as input and returns their product.\n\n### Response:\n",
|
|
"prompt_format": "Below is an instruction that describes a task, paired with an input that provides further context. Complete the request to the best of your ability.\n\n### Instruction:\nWrite a python program that solves the following programming problem.\n\n### Input:\n{instruction}\n\n### Response:\n"
|
|
}
|
|
] |