Last active
November 20, 2019 11:04
-
-
Save gaspart/8295b12cfed7a7910a044e4475b90899 to your computer and use it in GitHub Desktop.
very simple code to check if a number is prime
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
import sys | |
i = 2 | |
numero = int(input("Dimmi un numero, e ti dirò se è un NUMERO PRIMO: ")) | |
print() | |
while i < numero: | |
if numero % i == 0: | |
print(str(numero) + " è divisibile per " + str(i)) | |
sys.exit() | |
i += 1 | |
next | |
print(str(numero) + " è primo") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment