Question: Write a Python function isPrime() that gets an integer as parameter and returns True if the parameter is a prime number, False otherwise. Write
Write a Python function isPrime() that gets an integer as parameter and returns True if the parameter is a prime number, False otherwise. Write another function twinPrimes() that gets no parameter but prints all twin prime numbers less than 100. This second function will call the first function. In main program, input a number entered by user and check if it is a prime number, then call the function twinPrimes() to print all twin prime numbers less than 100. Hint: Twin primes are pairs of primes of the form (p, p+2). Example: (3,5), (5,7), (11,13)... Note: Print the twin prime numbers in a series of lists in the format shown in the example below. Part 1: Please enter a number: 5 The number 5 is prime. The twin prime numbers are: (3, 5) (5, 7) (11, 13) (17, 19) (29, 31) (41, 43) (59, 61) (71, 73)
Step by Step Solution
There are 3 Steps involved in it
Heres the Python code to accomplish the task python def isPrimenum if num 2 return Fal... View full answer
Get step-by-step solutions from verified subject matter experts
