Question: Formulate a function called is prime that takes a number, and prints is Prime if it is prime and is Not Prime if
Formulate a function called is prime that takes a number, and prints " is Prime" if it is prime and is Not Prime" if it is not (filling in the blank with the number passed) Formulate a main function that calls is_prime several times, once for each of these numbers (which should be passed as its parameter): 0,1,2,3,4,5,6,7,8,9 Add this to the bottom of your program: if _name__=='__main__": main() Remember: 0 and 1 are not prime! 2 is Prime and numbers after 2 are prime if they are not a product of two smaller numbers (ie. not a multiple). Please be careful with indentation - ensure that all of your code is either in your is prime function or in the main function. It should look like this: def is prime (num): #check if num is prime, print the result def main(): #call is_prime 10 times (using a loop), passing it each of the following if _name__='___main__': main() numbers: 0,1,2,3,4,5,6,7,8,9
Step by Step Solution
3.39 Rating (158 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
