← Back to challenges

Stupid Addition

PythonHardvalidationstringsnumbersconditions

Instructions

Create a function that takes two parameters and, if both parameters are strings, add them as if they were integers or if the two parameters are integers, concatenate them.

Examples

stupid_addition(1, 2) ➞ "12"

stupid_addition("1", "2") ➞ 3

stupid_addition("1", 2) ➞ None

Notes

  • If the two parameters are different data types, return None.
  • All parameters will either be strings or integers.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Extending The String