Python 3 For and Else Statement

Python 3 For and Else Statement
返回Python,Statement常用代码示例代码片段
#!/usr/bin/python3

numbers = [11,33,55,39,55,75,37,21,23,41,13]

for num in numbers:
   if num%2 == 0:
      print ('the list contains an even number')
      break
else:
   print ('the list doesnot contain even number')
原文链接:https://rumenz.com/examples/python3/python-3-for-and-else-statement.html

【Linux常用命令速查手册】关注【入门小站】,后台回复 「1001」 自取。

点击下面标题即可获取对应PDF资料
↑回到顶部↑
入门小站 @2018