python中的循環函數有以下兩種
1.for循環
sum = 0for x in range(5):sum = sum + xprint(sum)
sum = 0
for x in range(5):
sum = sum + x
print(sum)
2.while循環
sum = 0n = 1while n < 5:sum = sum + nn = n+1print(sum)
n = 1
while n < 5:
sum = sum + n
n = n+1
億速云公眾號
手機網站二維碼
Copyright ? Yisu Cloud Ltd. All Rights Reserved. 2018 版權所有
廣州億速云計算有限公司粵ICP備17096448號-1 粵公網安備 44010402001142號增值電信業務經營許可證編號:B1-20181529