Mat*_*ard 1 python loops while-loop
class Solution:
def display(self,head):
current = head
while current:
print(current.data,end=' ')
current = current.next
Run Code Online (Sandbox Code Playgroud)
你好,我在理解上面的循环时有些困难,AFAIK你需要有一个while循环的条件,所以:
while (stuff) == True:
Run Code Online (Sandbox Code Playgroud)
但上面的代码有:
while current:
Run Code Online (Sandbox Code Playgroud)
这是一样的:
while current == head:
Run Code Online (Sandbox Code Playgroud)
谢谢
归档时间: |
|
查看次数: |
1032 次 |
最近记录: |