Back
Look at the below code:
def cube(number): return number^3print cube(2)
def cube(number):
return number^3
print cube(2)
I expect the output as 8, but instead, I'm getting 1 as output
Where did I go wrong? Anyone, please help me!
Here, You've used ^ operator, which is a xor operator.
To find the exponentiation you've to use ** symbol
2**3 =8
Join python training course fast, if you want to learn python in detail!
31k questions
32.8k answers
501 comments
693 users