Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Fri Apr 20 10:54:47 2018
- @author: joaoc
- """
- n=10
- x=0
- lista=[]
- def primo(x):
- assert (type(x) is int)
- i = 2
- aux = 0
- #res = x % i
- while i!=x-1:
- res = x % i
- if res==0:
- aux = 1
- return 'não é primo'
- i+=1
- if aux == 0:
- return 'é primo'
- def todosprimos():
- x = 0
- while x!=n-1:
- if primo(x)=='é primo':
- lista.append(x)
- x+=1
- def resposta():
- return 'o 10001º numero primo é:',lista[:1]
- if __name__ == "__main__":
- todosprimos()
- print lista
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement