Learning Scientific Programming with Python (2nd edition)

P4.1.3: Raising an exception on $0^0$

Question P4.1.3

Python follows the covention of many computer languages in choosing to define $0^0=1$. Write a function, powr(a, b) which behaves the same as the Python expression a**b (or, for that matter, math.pow(a,b)) but raises a ValueError if a and b are both zero.