subject

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:
5
2
4
6
8
10
the output is:
all even
Ex: If the input is:
5
1
3
5
7
9
the output is:
all odd
Ex: If the input is:
5
1
2
3
4
5
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_odd() returns true if all integers in the list are odd and false otherwise.
def is_list_even(my_list)
def is_list_odd(my_list)
My Current Code:
def GetUserValues():
myList=[]
n=int(input())
for i in range(n):
myList. append(int(input()))
return myList
def IsListEven(myList):
for i in range(len(myList)):
if myList[i]%2 !=0:
return False
return True
def IsListOdd(myList):
for i in range(len(myList)):
if myList[i]%2==0:
return False
return True
list=GetUserValues()
if IsListOdd(list)==True:
print("all odd")
elif IsListEven(list)==True:
print("all even")
else:
print("not even or odd")

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
For all machines-not just hammers- the user applies force force to the machine to the machine over a certain distance. a. input b. output c. duo d. none of the above
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
This graph compares the total cost of attending educational institutions in texas. the graph demonstrates that the cost at private and public technical schools greatly varies.
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
Which tab is used to change the theme of a photo album slide show? a. design b. view c. transitions d. home
Answers: 1
question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
You know the right answer?
Write a program that reads a list of integers, and outputs whether the list contains all even number...
Questions
question
Health, 06.05.2020 02:29
question
Mathematics, 06.05.2020 02:29
question
Spanish, 06.05.2020 02:29
question
Mathematics, 06.05.2020 02:29
question
Social Studies, 06.05.2020 02:29
Questions on the website: 13722362