Square function
Input
pow_factory(2)(3)
Output
9
pow_factory(2) returns a function that squares its input: 3**2 == 9.
Full lesson preview
Build a function factory that returns power functions with optional modular arithmetic.
Problem statement
Task
Examples
Input
pow_factory(2)(3)
Output
9
pow_factory(2) returns a function that squares its input: 3**2 == 9.
Input format
Output format
Constraints
Samples
Input
pow_factory(0.5)(9)
Output
3.0
exp=0.5 returns square-root function; sqrt(9) == 3.0