Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- '''
- Código Desenvolvido por Felipe Silva Machado
- Verificação refatorada se o número é primo ou não.
- Link do GitHub com código mais completo: https://github.com/LipeMachado/refactored-prime-number
- '''
- def numberPrime(num):
- isPrime = True;
- divisoes = 2;
- while divisoes < num and isPrime:
- if num % divisoes == 0:
- isPrime = False
- divisoes += 1
- if isPrime and num != 1:
- return True
- else:
- return False
- print("Seu número é primo?")
- userNumber = int(input("Digite um número: "))
- print(numberPrime(userNumber))
Advertisement
Add Comment
Please, Sign In to add comment