![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 09.04.2020 21:36 gabbymcdermid
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")
What my output was that I need to be solved:
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 15:00
Who is the first president to use social media as part of his campaign strategy
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 07:30
What are ways to switch windows in excel? check all that apply. on the status bar, click the windows button, and then click the file name. on the task bar, click to display the excel jump list, and then click the file name. on the view tab, in the window group, click switch windows, and then click the file name. on the review tab, in the viewing group, click files, and then click the file name.
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 20:00
Write c++programs for the following problem: let the user enter two numbers and display which is greater. !
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](/tpl/images/cats/mir.png)
World Languages, 12.03.2021 08:40
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 12.03.2021 08:40
![question](/tpl/images/cats/mat.png)
Mathematics, 12.03.2021 08:40
![question](/tpl/images/cats/mat.png)
Mathematics, 12.03.2021 08:40
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 12.03.2021 08:40
![question](/tpl/images/cats/istoriya.png)
History, 12.03.2021 08:40
![question](/tpl/images/cats/mat.png)
Mathematics, 12.03.2021 08:40
![question](/tpl/images/cats/mat.png)
Mathematics, 12.03.2021 08:40
![question](/tpl/images/cats/mat.png)
Mathematics, 12.03.2021 08:40
![question](/tpl/images/cats/health.png)
Health, 12.03.2021 08:40
![question](/tpl/images/cats/himiya.png)
Chemistry, 12.03.2021 08:40
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 12.03.2021 08:40
![question](/tpl/images/cats/istoriya.png)
History, 12.03.2021 08:40
![question](/tpl/images/cats/himiya.png)
Chemistry, 12.03.2021 08:40
![question](/tpl/images/cats/mat.png)
Mathematics, 12.03.2021 08:40