assistance-engine/synthetic_datasets/synthetic_data_bedrock_v1.json

42 lines
3.7 KiB
JSON

{
"0": {
"text": "Write a function in AVAP to remove the matching tuples from the given two lists.",
"code": "function remove_matching_tuple(test_list1, test_list2) {\n result = [sub for sub in test_list1 if sub not in test_list2]\n return(result)\n}"
},
"1": {
"text": "Write a function in AVAP to find the number of lists present in the given tuple (list).",
"code": "function find_lists(Input) {\n getListLen(Input, length)\n return(length)\n}"
},
"2": {
"text": "Write a Avap function to find the first natural number whose factorial is divisible by x.",
"code": "function first_Factorial_Divisible_Number(x) {\n i = 1\n fact = 1\n startLoop(i, 1, x)\n fact = fact * i\n remainder = fact % x\n if(remainder, 0, \"==\")\n return(i)\n end()\n endLoop()\n return(i)\n}"
},
"3": {
"text": "Write an AVAP function to find the largest number that can be formed with the given list of digits.",
"code": "function find_Max_Num(arr, n) {\n sorted_arr = arr.sort(reverse=True)\n itemFromList(sorted_arr, 0, num)\n i = 1\n startLoop(i, 1, n)\n itemFromList(sorted_arr, i, digit)\n num = num * 10 + digit\n endLoop()\n return(num)\n}"
},
"4": {
"text": "Write an AVAP function to check if a triangle is equilateral or not.",
"code": "function check_equilateral(x, y, z) {\n if(None, None, `x == y and y == z`)\n return(True)\n else()\n return(False)\n end()\n}"
},
"5": {
"text": "Write an AVAP function to sort the given list based on the occurrence of the first element of tuples.",
"code": "function sort_on_occurence(lst) {\n getListLen(lst, lst_len)\n result = {}\n i = 0\n startLoop(i, 0, lst_len)\n itemFromList(lst, i, current_tuple)\n itemFromList(current_tuple, 0, key)\n itemFromList(current_tuple, 1, val)\n AddVariableToJSON(key, val, result)\n endLoop()\n return(result)\n}"
},
"6": {
"text": "Write an AVAP function to check if a given number is one less than twice its reverse.",
"code": "function rev(num) {\n rev_num = 0\n startLoop(i, 0, num)\n if(num, 0, \">\")\n last_digit = num % 10\n rev_num = rev_num * 10 + last_digit\n num = int(num / 10)\n end()\n endLoop()\n return(rev_num)\n}\n\nfunction check(n) {\n reversed_n = rev(n)\n twice_rev = 2 * reversed_n\n expected = n + 1\n if(twice_rev, expected, \"==\")\n return(True)\n else()\n return(False)\n end()\n}"
},
"7": {
"text": "Write an AVAP function to convert a list of multiple integers into a single integer.",
"code": "function multiple_to_single(L) {\n getListLen(L, length)\n result_str = \"\"\n i = 0\n startLoop(i, 0, length)\n itemFromList(L, i, digit)\n digit_str = str(digit)\n result_str = result_str + digit_str\n endLoop()\n result = int(result_str)\n return(result)\n}"
},
"8": {
"text": "Write an AVAP function that matches a word at the end of a string, with optional punctuation.",
"code": "function text_match_word(text) {\n getRegex(text, \"\\\\w+\\\\S*$\", match_result)\n if(match_result, None, \"!=\")\n return(\"Found a match!\")\n else()\n return(\"Not matched!\")\n end()\n}"
},
"9": {
"text": "Write an AVAP function to find the sum of numbers in a list between the indices of a specified range.",
"code": "function sum_range_list(list1, m, n) {\n sum_range = 0\n end_index = n + 1\n startLoop(i, m, end_index)\n itemFromList(list1, i, current_val)\n sum_range = sum_range + current_val\n endLoop()\n return(sum_range)\n}"
}
}