Question: Create a variable student and assign your name to this variable. A prime number is a number that is only evenly divisible by itself and
Create a variable "student" and assign your name to this variable.
A prime number is a number that is only evenly divisible by itself and For example, the number is prime because it can only be evenly divided by and The number however, is not prime because it can be divided evenly by and Design a Boolean function named isPrime, which takes an integer as an argument and returns True if the argument is a prime number, or False otherwise. Use the function in a program that prompts the user to enter a number and then displays, using f strings, your name; the input number, a message indicating whether the number is prime.
TIP: Recall that the MOD operator divides one number by another and returns the remainder of the division. In an expression such as num MOD num the MOD operator will return if num is evenly divisible by num
isPrime example:
if n :
return False
i
while ii n:
if n i :
return False
i
return True
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
