Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

def cube(number): 

return number^3 

print cube(2)

I would would expect cube(2) = 8, but instead I'm getting cube(2) = 1

What am I doing wrong?

1 Answer

0 votes
by (106k points)

You just need to follow the below-mentioned steps:-

^ is the xor operator.

** is exponentiation.

2**3 = 8

To know more about this you can have a look at the following video tutorial:-

Related questions

0 votes
1 answer
0 votes
4 answers
0 votes
4 answers
0 votes
1 answer
asked Feb 20, 2021 in Python by laddulakshana (16.4k points)

Browse Categories

...