Question
Write two functions is_even() and is_prime() under the module even_prime.py. Import module to the main, use the counter loop (1 to 100) for each function
Write two functions is_even() and is_prime() under the module even_prime.py. Import module to the main, use the counter loop (1 to 100) for each function and display output as the lists of even, odd, prime, and composite numbers as shown below. Remember, when a number isn't even, then it is an odd number, similarly, if a number isn't prime, then it is a composite number. To create a list, first, initialize an empty list and append the number to it from the counter.
(This should be output of your main() function)
The odd number list is:
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31,
33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61,
63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89,91,
93, 95, 97, 99]
The even number list is:
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32,
34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60,62, 64,
66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96,
98]
The prime number list is:
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
59, 61, 67, 71, 73, 79, 83, 89, 97]
The composite number list is:
[1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25,
26, 27, 28, 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45,
46, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 60, 62, 63,64,
65, 66, 68, 69, 70, 72, 74, 75, 76, 77, 78, 80, 81, 82, 84,
85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 98, 99]
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