未定义Python循环中的循环问题
我的循环不起作用未定义Python循环中的循环问题,python,Python,我的循环不起作用 Loop = True while loop: print ("hi") #should constanly print hi NameError:未定义名称“loop”问题在于,您将loop note大写字母L放入loop not大写字母L,然后将loop not大写字母L放入循环,这应该可以: 循环=真 while循环: 打印hi 您实际上不需要在这里声明变量 while True: print("hi") 循环与循环不同。大写L与小写L。这是不言自明
Loop = True
while loop:
print ("hi")
#should constanly print hi
NameError:未定义名称“loop”问题在于,您将loop note大写字母L放入loop not大写字母L,然后将loop not大写字母L放入循环,这应该可以: 循环=真 while循环: 打印hi
您实际上不需要在这里声明变量
while True:
print("hi")
循环与循环不同。大写L与小写L。这是不言自明的:NameError:未定义名称“loop”