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]
2 years 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]2 years 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
If you wish to maintain a consistent style to all the documents you create, it would be helpful to use a _​
kakasveta [241]

Answer:Apply a consistent look across the whole document instead of having to format each section individually.Automatically number section headers.Apply same font to the entire text body.Apply the same font to header sections.Use a consistent paragraph spacing.Pick a default color scheme for SmartArt, charts, and shapes.Pick from a number of pre-designed styles use them as your own and modify them.

Read more on Webcache.googleusercontent.com - https://webcache.googleusercontent.com/question/1639566#readmore

Explanation:

tht is the answer

7 0
3 years ago
if you wanted to round $3.99 located in cell b3, to the nearest dollar, what is the correct microsoft excel formula? a.=round(0.
Murljashka [212]
The answer is "b" the just due to the decimal places are 0, so it rounds to the nearest integer
5 0
3 years ago
A research team is studying parallel computing. They want to run parallel processes without having to use multiple processors. H
valentina_108 [34]
D by using locks okkkkkkkk
6 0
3 years ago
Read 2 more answers
PV = 11,000 AC = 6000 CV = 4,000. What is SV? What does this calculation tell you?
pogonyaev

Answer:

I don't see an SV in the examples.. I suspect these are the name plate numbers off of a transformer... but.. more context would really help

Explanation:

8 0
4 years ago
What does aperture control? A)amount of light the image sensor captures when taking a photo. B)how sensitive the camera is to in
My name is Ann [436]

Answer:

How sensitive the camera is to incoming light.

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Where can you change your web page SafeSearch settings?
    8·1 answer
  • If you want to use your computer for recording your band, you would benefit most from a(n)
    13·2 answers
  • What do yo need to do for device manager to display nonpresent devices?
    9·1 answer
  • Which of the following statements is false? People tend to shortcut security procedures because the procedures are inconvenient.
    13·1 answer
  • What do you think was the immediate effect of the introduction of handheld consoles and video games?
    6·1 answer
  • A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: The name of the clie
    8·1 answer
  • Intranets:
    8·1 answer
  • On his website, Mario has a video that visitors must click to play. He wants the video to play automatically when the page loads
    8·1 answer
  • State the function of the <br> BIOS,​
    11·1 answer
  • Write the functions of F1 to F12 on the keyboard​
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!