-2
x=0
while x<20:
    x+=1
    y=x^x
    print(y)

So the expected output to be 2,27,256,3125…………. But all it keeps showing is 0 0 0 0.

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425

1 Answers1

0

^ is bit-wise XOR. Exponentiation is **

x=0
while x < 20:
    x += 1
    y = x ** x
    print(y)
Prune
  • 75,308
  • 14
  • 55
  • 76