Create an Account

Already have account?

Forgot Your Password ?

Home / Questions / Write a program that reads a list of integers, and outputs whether the list contains all even number

Write a program that reads a list of integers, and outputs whether the list contains all even number

Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neithe

Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither. The input begins with an integer indicating the number of integers that follow. Ex: If the input is 6 10 the output is all even Ex: If the input is T the output is all odd Ex: If the input is: 5 2 4 the output is not even or odd Your program must define and call the following two functions. is list even) returns true if all integers in the list are even and false otherwise. is list odd0 returns true if all integers in the list are odd and false otherwise. def is list_even (my_list) def is liat odd (my 1ist) Instructor note: Define the is list evenmy list) and is list odd(my list) functions at the top then place your test code (that will gather user input, call the methods, and output the result) INSIDE the existing if statement. The check for is needed because the zyLab will perform a unit test of your method, importing this file as a module and call name ing the function directly. main__means your code is being executed directly and needs the input/output to execute. Otherwise, it is being imported and your test code won't need to run at all. LAB 6.22.1: LAB: Even/odd values in a list 6/10 ACTIVITY main.py Load default template... 1 Define your function here 2 3 if main' name 4 Type your code here. Nm n un e n

 

Apr 02 2020 View more View Less

Answer (Solved)

question Subscribe To Get Solution

Related Questions