{"record":{"id":"53dc824e1fe4c9a4","repo":"TheAlgorithms/Python","slug":"you-cannot-supply-more-or-less-than-2-values-53dc82","errorCode":null,"errorMessage":"You cannot supply more or less than 2 values","messagePattern":"You cannot supply more or less than 2 values","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"electronics/electric_conductivity.py","lineNumber":46,"sourceCode":"    >>> electric_conductivity(conductivity=50, electron_conc=-10, mobility=0)\n    Traceback (most recent call last):\n        ...\n    ValueError: Electron concentration cannot be negative\n    >>> electric_conductivity(conductivity=50, electron_conc=0, mobility=-10)\n    Traceback (most recent call last):\n        ...\n    ValueError: mobility cannot be negative\n    >>> electric_conductivity(conductivity=50, electron_conc=0, mobility=0)\n    Traceback (most recent call last):\n        ...\n    ValueError: You cannot supply more or less than 2 values\n    >>> electric_conductivity(conductivity=50, electron_conc=200, mobility=300)\n    Traceback (most recent call last):\n        ...\n    ValueError: You cannot supply more or less than 2 values\n    \"\"\"\n    if (conductivity, electron_conc, mobility).count(0) != 1:\n        raise ValueError(\"You cannot supply more or less than 2 values\")\n    elif conductivity < 0:\n        raise ValueError(\"Conductivity cannot be negative\")\n    elif electron_conc < 0:\n        raise ValueError(\"Electron concentration cannot be negative\")\n    elif mobility < 0:\n        raise ValueError(\"mobility cannot be negative\")\n    elif conductivity == 0:\n        return (\n            \"conductivity\",\n            mobility * electron_conc * ELECTRON_CHARGE,\n        )\n    elif electron_conc == 0:\n        return (\n            \"electron_conc\",\n            conductivity / (mobility * ELECTRON_CHARGE),\n        )\n    else:\n        return (","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/TheAlgorithms/Python/blob/f5988cc09713315817df6a7e327e258013a94440/electronics/electric_conductivity.py#L28-L64","documentation":"Thrown by electric_conductivity() in electronics/electric_conductivity.py when the number of zeros among (conductivity, electron_conc, mobility) is not exactly 1. The function solves sigma = n*e*mu for the single unknown, signaled by passing 0 for that argument; supplying zero for none or several arguments is ambiguous.","triggerScenarios":"electric_conductivity(conductivity=50, electron_conc=0, mobility=0) (two zeros) or electric_conductivity(conductivity=50, electron_conc=200, mobility=300) (no zero).","commonSituations":"Assuming all three arguments are required and passing measured values for each; None-coalescing to 0 defaults; confusion of the '0 means solve-for-this' convention shared by several functions in this electronics package.","solutions":["Pass exactly one argument as 0 (the unknown) and positive values for the other two.","Read the function's docstring doctests to confirm the intended calling convention before wiring calls.","Wrap the call with a helper that takes explicit 'solve_for' semantics if the 0-marker convention is error-prone in your codebase."],"exampleFix":"# before\nelectric_conductivity(conductivity=50, electron_conc=200, mobility=300)  # no unknown\n\n# after\nelectric_conductivity(conductivity=0, electron_conc=200, mobility=300)\n# -> ('conductivity', ...)","handlingStrategy":"validation","validationCode":"args = (conductivity, electron_conc, mobility)\nif args.count(0) != 1:\n    raise ValueError(\"pass exactly one 0 as the unknown\")\nname, value = electric_conductivity(*args)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Same 0-means-unknown convention as carrier_concentration and electric_power.","Write a thin wrapper with solve_for='conductivity' semantics to avoid sentinel mistakes."],"tags":["electronics","semiconductor","physics","validation","solver-api"],"backgroundTag":null,"analyzedSha":"f5988cc09713315817df6a7e327e258013a94440","analyzedAt":"2026-08-14T17:30:07.041Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}