Can print (0**0) in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can print (0**0) in Python?

Based on our math rule, 1**0==1, but no 0**0. Is it reasonable in python to print(0**0), which returns 1?

18th Nov 2019, 7:09 PM
Storm Yule
Storm Yule - avatar
5 Answers
18th Nov 2019, 7:14 PM
Diego
Diego - avatar
+ 7
Interesting question. Wolfram Alpha gives undefined for 0^0 https://www.wolframalpha.com/input/?i=0%5E0 And I found this too: https://stackoverflow.com/questions/14414430/why-0-0-equals-1-in-JUMP_LINK__&&__python__&&__JUMP_LINK Actually, even mathemathicians disagree what it should be, and "Most programming languages follow the convention that 0 ** 0 == 1. Python is no exception, both for integer and floating-point arguments."
18th Nov 2019, 7:18 PM
Tibor Santa
Tibor Santa - avatar
+ 1
thank you Diego
18th Nov 2019, 7:16 PM
Storm Yule
Storm Yule - avatar
+ 1
Thanks Tibor Santa for your great answer!
18th Nov 2019, 7:20 PM
Storm Yule
Storm Yule - avatar
0
According to mathematics , 0**0=1 and all computer languages follows the rules of mathematics
20th Nov 2019, 6:20 PM
Krishna Gupta
Krishna Gupta - avatar