-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
When I was looking at the evaluation questions, I found that some PHP questions required the code to be converted into PHP, but the reference code provided was already PHP. Is this intentionally designed to test the model copying ability or is it a design error?
Two examples are as follows:
"content": "Please convert the following code to PHP, with the function signature `function order_by_points($nums)`\nNote:\n1. Only implement the target function and import necessary packages, do not generate other code\n\n```php\n\nfunction order_by_points($nums) {\n \n function digits_sum($n) {\n $neg = 1;\n if ($n < 0) {\n $n = -1 * $n;\n $neg = -1;\n }\n $n = array_map('intval', str_split($n));\n $n[0] = $n[0] * $neg;\n return array_sum($n);\n }\n usort($nums, function($a, $b) {\n return digits_sum($a) <=> digits_sum($b);\n });\n return $nums;\n}\n\n```",
"id": 297,
"content": "Please convert the following code to PHP, with the function signature `function do_algebra($operator, $operand)`. Note: Only implement the target function and import necessary packages, do not generate other code.\n\n```php\n\nfunction do_algebra($operator, $operand) {\n\n $expression = strval($operand[0]);\n foreach (array_combine($operator, array_slice($operand, 1)) as $oprt => $oprn) {\n $expression .= $oprt . strval($oprn);\n }\n return eval('return '.$expression.';');\n}\n\n```",
"id": 298,
Metadata
Metadata
Assignees
Labels
No labels