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
Which type of infrastructure service stores and manages corporate data and provides capabilities for analyzing the data
Katena32 [7]

Answer:

Data management.

Explanation:

A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to effectively and efficiently create, store, modify, retrieve, centralize and manage data or informations in a database. Thus, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.

Generally, a database management system (DBMS) acts as an intermediary between the physical data files stored on a computer system and any software application or program.

Hence, a database management system (DBMS) is a software that enables an organization or business firm to centralize data, manage the data efficiently while providing authorized users a significant level of access to the stored data.

In conclusion, data management is a type of infrastructure service that avails businesses (companies) the ability to store and manage corporate data while providing capabilities for analyzing these data.

7 0
3 years ago
Nowadays computer games are mostly available on external<br> hard disk.<br> Is it true or false?
sergey [27]

Answer:

false

Explanation:

because a lot of times they are downloads without the disk

7 0
4 years ago
Read 2 more answers
1. Open command prompt
icang [17]

Answer:

What do you want me to do

Explanation:

3 0
3 years ago
What technology is used with building a closet organizer?
vaieri [72.5K]

Answer:builder

Explanation:

4 0
4 years ago
Read 2 more answers
What are the external and internal parts of a computer?
insens350 [35]
The internal parts is the motherboard, cpu, gpu, ethernet card, hard disk... And the computer can't run without it.
And the external parts are the parts thats the computer can run without it, for example: The USB (or Removable media), Keyboard, mouse, webcam... The accessories...
7 0
3 years ago
Other questions:
  • which of these is a placeholder in a document into which variable data is inserted during the process of a mail merge?
    10·2 answers
  • What is an ISP?<br> in computer Networking
    11·2 answers
  • You are interested in buying a laptop computer. Your list of considerations include the computer's speed in processing data, its
    15·1 answer
  • Suppose you will invest $100 per month at the beginning of the month for 40 years with interest rate
    5·1 answer
  • Explain: The decode part of fetch decode execute cycle
    9·2 answers
  • Where will the append() function add a new element to a list? A. At the end of the list B. At the beginning of the list C. In th
    10·1 answer
  • When a person bullies someone using technology, it's called:
    9·2 answers
  • 1. How many bits would you need to address a 2M × 32 memory if:
    8·1 answer
  • spreadsheet solution Credit Score Current Rate First Name: Mary 500 6.50% Last Name: Bell 550 6.25% Address: 123 First Street 60
    11·1 answer
  • In cybersecurity, a threat actor is an individual or an entity responsible for cyber incidents against the technical equipment o
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!