Write a Python function that takes a number as a parameter and checks if the number is prime or not. Return True if the number is prime, otherwise return False.
Example 1:
Input: 5
Output: True
Example 2:
Input: 4
Output: False
A prime number is a number that has only two distinct positive divisors: 1 and itself.
def check_prime(num):
if num > 1:
for i in range(2, num):
if (num % i) == 0:
return False
else:
return True
else:
return False
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.