Created
March 23, 2012 13:18
-
-
Save rswofxd/2170541 to your computer and use it in GitHub Desktop.
for-in遍历
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
for n in range(2,10) | |
for x in range(2,n) | |
if n % x==0: | |
print(n,'equals',x,'*',n//x) | |
break #而pass语句不做任何操作 | |
else: | |
print(n,'is a prime number') | |
input() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment