Skip to content

Instantly share code, notes, and snippets.

@rswofxd
Created March 23, 2012 13:18
Show Gist options
  • Save rswofxd/2170541 to your computer and use it in GitHub Desktop.
Save rswofxd/2170541 to your computer and use it in GitHub Desktop.
for-in遍历
# -*- 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