태지쌤

로봇 & 코딩교육 No.1 크리에이터

파이썬/exercise

8-2. python prime number checker

태지쌤 2023. 1. 4. 15:06
반응형
def prime_checker(number):
	is_prime = True
	for n in range(2, number):
		if number % n == 0:
			is_prime = False
	if is_prime == True:
		print(f"{number} is prime")
	else:
		print(f"{number} is not prime")
#Write your code above this line 👆
    
#Do NOT change any of the code below👇
n = int(input("Check this number: "))
prime_checker(number=n)
반응형