1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Readme [11.4K]
3 years ago
10

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)
Computers and Technology
1 answer:
Ivahew [28]3 years ago
7 0

Answer:

def is_list_even(list):  

 return all((x % 2) == 0 for x in list)  

def is_list_odd(list):

 return all((x % 2) == 1 for x in list)  

numberList = []  

n = int(input("Enter number of elements : "))  

for i in range(0, n):  

 numberList.append(int(input()))

if is_list_even(numberList):

 print("all even")

elif is_list_odd(numberList):

 print("all odd")

else:

 print("not even or odd")

You might be interested in
Driving is expensive. Write a program with two inputs, a car's miles/gallon and the cost of gas/gallon both represented as doubl
Nataly_w [17]

Answer:33

Explanation:

6 0
3 years ago
Communication among office computers is based on a protocol that uses CRC-32 for error detection. A series of 100 identical test
Fiesta28 [93]
I think it is the CRC-32 for error detection
4 0
3 years ago
C was created to work with UNIX systems in1972, and would be the foundation for several other programming languages, including j
san4es73 [151]

Answer:

True

Explanation:

C language is developed with the help of UNIX in 1972. It was developed by Denis Ritchie at Bell labs. many languages are developed with the help of C Platform. Such as C++, C sharp and Java.

7 0
3 years ago
Don't click on this I am testing
Andrew [12]

Don't click on this I am testing... I want the points so.

3 0
3 years ago
Read 2 more answers
You have a MySQL database running on an EC2 instance in a private subnet. You can connect via SSH, but you are unable to apply u
AnnZ [28]

Answer:

Ensure that "Source/Destination Checks" is disabled on the NAT instance.

Explanation:

A NAT (Network Address Translation) instance is, like a bastion host, an EC2 instance that lives in your public subnet. A NAT instance, however, allows your private instances outgoing connectivity to the internet while at the same time blocking inbound traffic from the internet.

Many people configure their NAT instances to allow private instances to access the internet for important operating system updates. Patching your OS is an important part of maintaining instance level security.

NAT device enables instances in a private subnet to connect to the Internet or other AWS services, but prevents the Internet from initiating connections with the instances.

NAT devices do not support IPv6 traffic, use an egress-only Internet gateway instead.

5 0
3 years ago
Other questions:
  • Describe network in terms of the class computer lab
    14·1 answer
  • Soo...My Old 3DS XL haven't been touched in around a year...So i tried to charge it but no LED lights opened..Even the power but
    14·1 answer
  • IN THE MOVIE BACK TO THE FUTURE 1985 IS 1985 THE PUBLICATION DATE?WHERE CAN I FIND THE MOVIE?
    6·1 answer
  • What can Strings store
    15·2 answers
  • What does the revolver do computer science​
    9·1 answer
  • Will give brainliest!<br> Who created binary, and does anyone have any idea how?
    13·1 answer
  • E) Point out the errors( if any) and correct them:-
    14·1 answer
  • Which insert image option allows a user to compile, modify, and add captions to images?
    5·2 answers
  • How do you modify WordArt? Give specific details and steps<br><br> NEED THIS ASAP
    9·1 answer
  • What is your idea for creating a new and fresh Gaming experience around viewing occasions for Mike's?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!