**New course!**Every coder should learn

**Generative AI!**

+ 2

# I am a beginner . so how to write exponential in python

10 Answers

+ 7

Exponentiation operator uses a double asterisk:
2**5 == 32
0**1 == 0
0**0 == 1

+ 7

Yes, it depends on implementation of the exponentiation operator - which rule fires off first - 0**x == 0 or x**0 == 1 :)
Other languages might have other results.

+ 3

Angelo B.
You are right, there is no universally accepted definition for 0**0. Kuba summed up the reason succinctly: while "anything" to the power of zero is 1, zero to the power of "anything" is zero.
However, it is sometimes defined as 1 in some branches of mathematics (like algebra, set theory, and combinatorics) for the sake of convenience.
You can read more at https://en.m.wikipedia.org/wiki/Zero_to_the_power_of_zero

+ 2

Thanks to all but, if you try in programming languages 0/0, that is an indeterminate form, the result is an error or NAN. I think the result =1 only for convention, infact all calculators give 1 as result, but strictly math speaking, this is not the true

+ 1

In math 0**0 Is indefinite form, not 1. Strange result

+ 1

iirc anything to the power of 0 is 1, and 0 itself isn't exempt from this. kinda like how 0! is 1, it just works. Angelo B.

0

maybe using numpy the result is correct.

- 3

angelo B. 0**0 is 1 becase 0**0 means nothing at all but there must be something.so it becomes 1*0**0 which is 1