Question: The program shown below intends to identify numbers as even or odd. Even numbers are those completely divisible by 2, such as 2, 4,
The program shown below intends to identify numbers as even or odd. Even numbers are those completely divisible by 2, such as 2, 4, 6, 8, 10, etc. In contrast, odd numbers are not completely divisible by 2, such as 1, 3, 5, 7, 9, etc. For the code shown below, please complete the following tasks. To claim full credit, you must provide answers for each of the tasks. A. Determine if the code runs. B. Suppose line 3 is modified, so the number is no longer chosen randomly but is a constant. Please provide the program's outputs for number = 15 and number = 18. C. Does the code shown below correctly identify numbers as even or odd? Identify any errors. D. Provide a revised code without errors. from random import randint number randint(1, 30) if number % 2 == 0: print(number, "is even.") print(number, "is odd")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
