Python Programming
knowledge skill
Write or modify Python code to implement a specified algorithm or solve a stated problem. Produces a Python file (.py) containing executable code with functions or scripts.
Worked examples
- {"input": {"task_description": "Implement binary search on a sorted list", "dependencies": ["typing"], "algorithm": "binary_search"}, "output": {"code_file": "def binary_search(arr, target):\n low, high = 0, len(arr) - 1\n while low <= high:\n mid = (low + high) // 2\n if arr[mid] == target:\n return mid\n elif arr[mid] < target:\n low = mid + 1\n else:\n high = mid - 1\n return -1", "syntax_valid": true, "imports": []}}
- {"input": {"task_description": "Create a script to read a CSV and calculate the mean of a numeric column", "dependencies": ["pandas", "sys"], "algorithm": "csv_mean"}, "output": {"code_file": "import pandas as pd\nimport sys\n\ndef csv_mean(file_path, column):\n df = pd.read_csv(file_path)\n return df[column].mean()\n\nif __name__ == \"__main__\":\n print(csv_mean(sys.argv[1], sys.argv[2]))", "syntax_valid": true, "imports": ["pandas", "sys"]}}
Input
- task_description: string
- dependencies: array of strings
- algorithm: string
Output
- code_file: string
- syntax_valid: boolean
- imports: array of strings
Details
- Skill type: knowledge skill
- Safety level: safe_public_research
- Version: 1.0.0