-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
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

^ is bit-wise XOR. Exponentiation is **

x=0
while x < 20:
    x += 1
    y = x ** x
    print(y)
Prune
  • 76,765
  • 14
  • 60
  • 81