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
Marina CMI [18]
1 year ago
5

9.18 lab: even/odd values in a vector write a program that reads a list of integers, and outputs whether the list contains all e

ven 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. isvectoreven returns true if all integers in the array are even and false otherwise. isvectorodd returns true if all integers in the array are odd and false otherwise. bool isvectoreven(vector myvec) bool isvectorodd(vector myvec)
Computers and Technology
1 answer:
lana66690 [7]1 year ago
6 0

def is_list_even(my_list):

   for i in my_list:

       if(i%2 != 0):

           return False

   

   return True

   

   

def is_list_odd(my_list):

   for i in my_list:

       if(i%2 == 0):

           return False

   

   return True

   

def main():

   n = int(input())

   lst = []

   

   for i in range(n):

       lst.append(int(input()))

   

   if(is_list_even(lst)):

       print('all even')

   

   elif(is_list_odd(lst)):

       print('all odd')

   

   else:

       print('not even or odd')

       

       

if __name__ == '__main__':

   main()

You might be interested in
What can you use to make sure that you have no errors in Word Online?
Free_Kalibri [48]

Answer:

You can use grammarly. It woks amazingly!

Explanation:

3 0
2 years ago
In cyber security, one of the best ways to protect a computer or network is with a strategy called defense in depth. This strate
emmainna [20.7K]

This idea is most closely related to the Layering in terms of how to reduce complexity.

<h3>Describe cybersecurity?</h3>

The term "cybersecurity" refers to the safeguarding of computer systems and networks against the leakage, theft, or destruction of data as well as the interruption of the services they offer.

Defense in depth is a technique used in cybersecurity that is one of the greatest ways to safeguard a computer or network. If one fails, it's likely that another will identify the issue. The approach to simplifying that is most in line with is called layering.

Thus, This idea is most closely related to the Layering in terms

For further details about cybersecurity, click here:

brainly.com/question/13016321

#SPJ1

5 0
2 years ago
Read 2 more answers
Jim is in the market for a car that will last for the next 10 years and has saved up some money for the purpose of a car. What’s
Ratling [72]
I would imagine car would still be the best means , it's tough to define without knowing where he lives and how much he travels
8 0
3 years ago
A system forensics specialist has three basic tasks related to handling evidence: find evidence, preserve evidence, and ________
dmitriy555 [2]

Answer:

It would be Store

Explanation:

hope this helps if not sorry :(

3 0
2 years ago
As Jason walks down the street, a large raven starts squawking at him and flapping its wings. Jason thinks to himself ‘That bird
UNO [17]

Answer:

Answer to the following question is anthropomorphism.

Explanation:

Anthropomorphism is considered as the error in the following context of the scientific reductionism. Anthropomorphize is the source of an error that needs to reconsider.

Anthropomorphism is an attribute of the human qualities, emotions, thoughts, motivation, intentions, and characteristics to the non-living beings or the nonhuman beings, things or objects.

8 0
2 years ago
Other questions:
  • Operating systems are designed to work with specific hardware. Which operating system works with Apple computers?
    8·2 answers
  • According to Holpp and Kelly's approaches to developing vision, the benchmarking approach is more internally focused, whereas th
    6·1 answer
  • An information security ________ is a specification of a model to be followed during the design, selection, and initial and ongo
    11·2 answers
  • Monica spent a lot of time preparing for her interview, but the hiring manager is not asking any of the questions she practiced.
    9·2 answers
  • landon starts his computer and gets message, hard drive is not found. He was watching a movie the previous night, what might the
    6·1 answer
  • With a presentation open, you can hover your mouse pointer over a design theme on the Design tab, and PowerPoint will display th
    14·1 answer
  • You are looking at computer ads. One has a processor that is 3.64GHz. What does this mean?
    5·1 answer
  • In the software development process, which review studies the software design before it is released for coding?
    7·1 answer
  • Describe some things that this person might say that might cause you to NOT hire them. Explain.
    6·1 answer
  • Question #4
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!