请问为什么这两段同样的python程序输出了不同的结果?

问题遇到的现象和发生背景

一个输出了正确的结果,一个输出了false:

问题相关代码,请勿粘贴截图

第一个:
x=int(input('please enter an integer'))
please enter an integer16
pwr=2
root=0
while pwr<7 and pwr>1:
while root**pwr<abs(x):
root==root+1
if root**pwr==abs(x):
if x>=0:
print(pwr,root)
else:
if pwr%2!=0:
root=-root
print(pwr,root)
else:
print('no')
break
else:
root=1
pwr=pwr+1
else:
print('no')

False
False
False
False

第二个:
x=int(input('please enter an integer'))
please enter an integer16
pwr=2
root=0
while pwr<7 and pwr>1:
while root**pwr<abs(x):
root=root+1
if root**pwr==abs(x):
if x>=0:
print(pwr,root)
else:
if pwr%2!=0:
root=-root
print(pwr,root)
else:
print('no')
break
else:
root=1
pwr=pwr+1
else:
print('no')

2 4

运行结果及报错内容

img

img

我的解答思路和尝试过的方法
我想要达到的结果

请问是为什么

第二个图里的代码(第一个文本)的内循环while里面的 root==root+1 应该是 root=root+1 吧?