Created
May 5, 2018 16:10
-
-
Save penut85420/29e7e850eb41883e5652cb6c74c8d295 to your computer and use it in GitHub Desktop.
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
isPrime = False | |
while isPrime == False: | |
number1 = eval(input("請輸入一個數值: ")) | |
isPrime = True | |
k = 2 | |
while k < number1 and isPrime: | |
if number1 % k == 0: | |
isPrime = False | |
k += 1 | |
if isPrime == True: | |
print(str(number1), "為質數") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment