Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
12
Task/Zero-to-the-zero-power/Python/zero-to-the-zero-power.py
Normal file
12
Task/Zero-to-the-zero-power/Python/zero-to-the-zero-power.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from decimal import Decimal
|
||||
from fractions import Fraction
|
||||
for n in (Decimal(0), Fraction(0, 1), complex(0), float(0), int(0)):
|
||||
try:
|
||||
n1 = n**n
|
||||
except:
|
||||
n1 = '<Raised exception>'
|
||||
try:
|
||||
n2 = pow(n, n)
|
||||
except:
|
||||
n2 = '<Raised exception>'
|
||||
print('%8s: ** -> %r; pow -> %r' % (n.__class__.__name__, n1, n2))
|
||||
Loading…
Add table
Add a link
Reference in a new issue