Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1: Prime numbers (25 pts) Write a Python function isPrime() that gets an integer as parameter and returns True if the parameter is a
Part 1: Prime numbers (25 pts) 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started