Advertisement
Uno2K

Aula5 - Numero Primo

Sep 16th, 2021
827
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. numero = int(input("Digite o numero para verificar se é PRIMO ou NÃO: "))
  2. def eh_primo(numero):
  3.     total = sum(numero % c == 0 for c in range(1, numero+1))
  4.     print('O numero {} foi divido {} vezes'.format(numero, total))
  5.     return total == 2
  6.  
  7. print(eh_primo(numero))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement