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 is netbeans and what is it for??
egoroff_w [7]

Answer:

NetBeans is an open-source integrated development environment (IDE) for developing with Java, PHP, C++, and other programming languages. NetBeans is also referred to as a platform of modular components used for developing Java desktop applications.

Explanation:

I know

4 0
3 years ago
Selah infects the ads on a website that users from her target company frequently visit with malware as part of her penetration t
ValentinkaMS [17]

Selah infects the ads on a website with a technique called the Watering hole attacks.

<h3> What is Watering hole attacks?</h3>

The  Watering hole attacks is known to be a form of attack that depends on compromising or infecting a website that has or that targeted users who are known to often frequently visit.

So, Selah infects the ads on a website with a technique called the Watering hole attacks.

Learn more about malware from

brainly.com/question/399317

#SPJ1

8 0
1 year ago
Float in is an example of a(n) _____. annotation, evolution, animation, simulation
Pavel [41]
Animation or C your welcome my friend
7 0
3 years ago
PlZZZZZZZ help will give Brainliest
dalvyx [7]

Answer:

Phone

Explanation:

3 0
2 years ago
Read 2 more answers
To achieve balance—that is, to operate an information system that satisfies the user and the security professional—the security
marta [7]

the answer is True

there has to be a balance between security and the user experience

7 0
3 years ago
Other questions:
  • Ian is working as a sales manager. He has to generate sales reports using mathematical data that his team has collected. Which c
    15·1 answer
  • I have a problem with importing excel file into Access. I have some table in Excel and I want to import it into Access. When I d
    6·2 answers
  • Which of the following is a full selector?
    12·1 answer
  • What is the approximate area of the figure? A. 129 square inches B. 113 square inches C. 110 square inches D. 44 square inches
    15·1 answer
  • For the questions below, consider a class called ChessPiece. This class has two instance data, String type and int player. The v
    13·1 answer
  • Implement function bin2dec that takes a binary number bin_num as a string argument and prints out the corresponding decimal numb
    9·1 answer
  • What are the advantages to using a linked implementation as opposed to an array implementation?
    8·1 answer
  • PLSSSSS HELPP!! Tropical rainforests are home to many kinds of birds, including parrots, toucans and eagles. Each different spec
    9·2 answers
  • Write an algorithm to display your name 10 times​
    5·1 answer
  • During system testing, developers test the program in an environment that is very similar to how the program will eventually be
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!