for 循環用在有次數的循環上。python
while循環用在有條件的循環上。express
while循環,知道表達式爲假,才退出。ide
while循環,表達式是一個邏輯表達式,必須返回一個True或Falsespa
語法:it
while expression:io
statements()class
#!/usr/bin/python循環
n = 0語法
while True:di
if n == 10:
break
print n,'hello'
n += 1