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 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. 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)

Answers

Answer 1

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()


Related Questions

what are project scope requirements?

Answers

Explanation:

Defining project scope requires input from the project stakeholders. They work with project managers to establish the key elements of budget, objectives, quality and timeline. To determine scope, project managers must collect requirements for what the stakeholders need from the project.

Answer:

The project scope outlines all the work required to deliver a project.

Explanation:

as well as any factors that define project sucess.

As a network administrator of your company, you have decided to implement redundant connections between network devices to solve problems like network bottlenecks. You have decided to implement this change so that multiple network interfaces and ports can act as one logical interface and focus on increasing total throughput and better load balancing. Which of the following will you use to implement this change in your Windows devices?a. Layer 4 switchesb. ToR switchesc. EoR switchesd. Layer 3 switchesAs a network administrator of your company, you have decided to implement redundant connections between network devices to solve problems like network bottlenecks. You have decided to implement this change so that multiple network interfaces and ports can act as one logical interface and focus on increasing total throughput and better load balancing. Which of the following will you use to implement this change in your Windows devices?a. Load balancingb. NIC teamingc. Clusteringd. Port aggregationYou run a website called Offhand that sells exclusive handmade home decor items. On Mother's Day, the website unexpectedly receives a burst of traffic following the marketing campaign designed for this occasion. Thankfully, you are equipped with a good cloud service model and hence you are able to increase the cloud resources the website needs without disrupting your web services. Which of the following cloud characteristics helped you manage the situation easily?a. Measured service.b. Resource pooling.c. Rapid elasticity.d. Broad network access.

Answers

The option that you will use to implement this change in your Windows devices is  Layer 3 switches.

What are the layer 3 switches?

A Layer 3 switch is is known to be one where a switch can carry out routing functions and also do its  switching.

Note that The option that you will use to implement this change in your Windows devices is  Layer 3 switches.

Learn more about  Layer 3 switches from

https://brainly.com/question/14594641

#SPJ1

Choose the missing term.

___ time

time.sleep(3)

1.form
2.insert
3.import

Answers

Answer:

import

Explanation:

the import keyword is used to import external modules into a python script.

What initialization vector (IV) do most weak implementations of the Wireless Equivalency Protocol (WEP) use

Answers

24 bits is an initialization vector (IV) which is used by most weak implementations of the Wireless Equivalency Protocol (WEP).

What is Wireless Equivalency Protocol (WEP)?

Wireless Equivalency Protocol (WEP) can be defined as a standard wireless protocol that is designed and developed to provide a significant level of security and privacy on 802.11b wireless local area network (WLAN).

According to the IEEE Wireless Fidelity (Wi-Fi) standard, 24 bits is an initialization vector (IV) which is used by most weak implementations of the Wireless Equivalency Protocol (WEP).

Read more on Wireless Equivalency Protocol here: https://brainly.com/question/13697151

#SPJ1

Mille gets a text from her friend asking if she wants to come over. It seems like a bit of a hassle to go to her friend's house, especially when they
could watch online videos together and talk over the phone. What is the BEST advice for Millie?
OA. Her friend will probably be relieved If she does not come over.
OB. They should just say whatever they want to say to each other over social media.
OC. It will be a more positive experience if she spends time with her friend in person.
OD. If they are doing the same activities virtually as they would if they were together, it does not make much difference.

Answers

Answer:

OC. It will be a more positive experience if she spends time with her friend in person.

Explanation:

You should always spend time with people in person rather than online whenever you get the chance.

What is a border line

Answers

Answer:

a border line is what separates to places from one another like if i were to go to mexico i would have to cross the border

Explanation:

Depends on context.

- Could be a line marking a border

- Barely acceptable; borderline

Example:

She was a borderline candidate.  

This means that she barely made it as a candidate role.

What words are familiar to people involved with computers? printer network, mouse and monitor screen software

Answers

The words that are familiar to people involved with computers are network, mouse and monitor screen.

What is a computer?

A computer simply refers to an electronic device that is designed and developed to receive data in its raw form as an input and processes these data into an output (information), which could be used by an end user to perform a specific task through the use of the following:

KeyboardNetworkMonitor screenMouse

In Computer technology, we can logically infer that network, mouse and monitor screen are the words that are familiar to people involved with computers.

Read more on computer here: brainly.com/question/959479

#SPJ4

Answer:

B

Explanation:

network, mouse and monitor

Explain why the connection times out despite adding the 'permit' statement for the End_User network to the ACL.

Answers

The connection timed out despite adding the 'permit' statement for the End_User network to the ACL because permission to be granted access was denied.

What is ACL?

ACL is an acronym for access control list which is the list of permissions that are related to the computer system network.

When an End-User is denied access to a network even after obtaining a permit statement, is could be that the End-User system has not been added to the list.

Learn more about network here:

https://brainly.com/question/26956118

Creating a map of your current knowledge is called __________. a. critical reading c. pre-questioning b. collaborative learning d. concept-mapping please select the best answer from the choices provided a b c d

Answers

Creating a map of your current knowledge is called  Concept-mapping. Check more about  Concept-mapping below.

What is concept mapping?

Concept maps are known to be visual depiction of information or human knowledge. They can be shown on a charts, graphic organizers, etc.

Therefore, Creating a map of your current knowledge is called  Concept-mapping as it involves bringing out one's intellectual.

Learn more about knowledge from

https://brainly.com/question/24621985

#SPJ4

Your client has acquired several small companies and would like to connect them together into one network. Not all of the routers are Cisco devices, and compatibility is a concern. Which WAN encapsulation method should you recommend your client use

Answers

Answer:

Extranet

Explanation:

Allows connection to other companies in a controlled manner.Provides access to Internet. permits workers to access information at any time.

Help me with this question asap please :)

Answers

Answer:

I think it's sequence as there is a pattern of connection in the words

PLEASE HELP! ITS A COMPUTER MCQ
The character that is displayed at the end of the code for continuation.
a. :
b. ;
c. .
d. ,

Answers

Answer:

b. ;

Explanation:

PLEASE MARK ME AS BRAINLIEST

Write a code snippet that asks the user to enter a name and a major repeatedly one at a time and creates a dictionary with keys corresponding to names and values corresponding to majors. Your code should include: d

Answers

The code snippet is an illustration of dictionary;

Dictionary are used to hold values in pairs i.e. data and key pairs

The code snippet

The program written in Python, where comments are used to explain each line is as follows:

#This gets the number of inputs

n = int(input("Number of inputs:"))

#This creates a dictionary

d = {}

#This iterates from 0 to n-1

for i in range(n):

   #This gets the keys i.e. names

   keys = input()

   #This gets the values i.e. majors

   values = input()

   #This populates the dictionary

   d[keys] = values

#This prints the dictionary

print(d)

Read more about Python programs at:

https://brainly.com/question/26497128

In what ways can information be slanted in a news report?

Answers

Answer:It all depends on who the reader is likely to be and the information they’ll want.

Explanation:

Newspaper 1: Company wins contract

Newspaper 2: Previous company loses contract (equally true)

Newspaper 3, say a student paper in the local town: Prospects for new jobs open up as company wins contract.

Kai recently graduated from college with a dual degree—a Bachelor’s in Game Design and Development and a Bachelor’s in Music. The goal is to find a job that will use both degrees, and there is an interview at a video game design studio tomorrow. Kai would love to be in charge of planning, authoring, and implementing the soundscape for games, including sound effects, music, and dialogue. What role at the video game studio would be a good fit?
character rigger

audio designer

artificial intelligence programmer

cinematic artist

Answers

Audio designer

Audio designers plan , sound effects, music and pretty much anything that has to do with sound in a video game

The date you type at the beginning of a letter or report should be the date that the document is _____.

Answers

The date that is typed at the beginning of a letter or report should be the date that the document is:

Written

What is the Date of a Letter or Report?

Typically, the first date that is seen at the beginning of a report a document often connotes the date of writing.

For instance, if the letter or report was written today, it will bear today's date. This will help the recipient to have a clear understanding of the time frame.

Learn more about letter writing here:

https://brainly.com/question/1155995

#SPJ4

What are the real-life applications of coding?

Answers

Some example's of coding affecting real life:

Traffic LightsBiometric SecurityRobots used in factories. can work in extreme conditions.Automatic Heater or Air Conditioner.Expert Systems used in for Medical Use.Smart Self Driving Cars

Create a program in writecustomerlist. java that allows a user to input customer records (id number, first name, last name, and balance owed) and save each record to a file named customerlist. txt. have the program accept input until zzz is input for the id number. write the records to customerlist. txt in csv format, for example:

101,john,smith,107. 5

41,jill,green,20. 0

when you execute the program, be sure to enter multiple records that have the same last name because you will search for repeated last names in part 4 of this exercise.


write an application named displaysavedcustomerlist. java that reads the file created by the writecustomerlist application and displays the records.


write an application named displayselectedcustomer. java that allows you to enter any id number, reads the customer data file created in step 1, and displays the data for the customer. display the message no records found if the id number cannot be found in the input file.


write an application named displayselectedcustomersbyname. java that allows you to enter any last name and displays all the data for customers with the given last name. display the message no records found if the name cannot be found in the input file.


write an application named displayselectedcustomersbybalance. java that allows you to enter any purchase amount and displays all the data for customers with balances greater than the entered value. display the message no records found if no customers meet the criteria

Answers

Using the knowledge in computational language in JAVA, this code can be written as:

Writing code in JAVA:

public String toString() {

return this.firstName+" " + this.lastName ;

}

System.out.println("Enter First Name: ");

   String firstName = input.nextLine();

   System.out.println("Enter Last Name: ");

   String lastName = input.nextLine();

   System.out.println("Enter Home Address: ");

   String homeAddress = input.nextLine();

   Customer cus = new Customer(firstName, lastName, homeAddress);

   System.out.println("\nWelcome: ");

   System.out.print(cus.getFirstName() + cus.getLastName());

   System.out.println("\n Your Shipping Address: ");

   System.out.print(cus.getHomeShippingAddress());

   List<Customer> customer = new ArrayList<Customer>();

   customer.add(cus);

   printList(customer);

}

public static void printList(List<Customer> list) {

   System.out.println("Customers: ");

   for (Customer customer : list) {

       System.out.printf("%s", customer);

   }

   System.out.println();

}

This JAVA code describes a program in writecustomerlist. java that allows a user to input customer records.

See more about JAVA at brainly.com/question/12975450

#SPJ1

Sum of Two Numbers: Write a program that stores the integers 50 and 100 in variables and stores the sum of these two in a variable named total. Display the total on the screen.

Answers

Answer:

fifty = 50 #variable to store 50

hundred = 100 #variable to store 100

total = fifty + hundred #add the two in a variable named total

print(total) #display on screen

3.7 Code Practice
can someone write a code for me

Answers

Answer:

Explanation:

raaaaa faraon- yt:

love shady

Allan needs to ensure that an object is in a very precise location on a slide. He decides to use the Ruler option to achieve this. On which tab is the Ruler option found?

Answers

Based on the above scenario,  the tab that is where one can find the Ruler option is the View tab.

On which tab is the ruler option Seen?

One can see the ruler option in the View tab that is in the tool bar at the top of the slide screen. Then look for the Ruler option in the Show group.

Therefore,  Based on the above scenario,  the tab that is where one can find the Ruler option is the View tab.

Learn more about Ruler option from

https://brainly.com/question/16399272

#SPJ1

a colleague shared an excel file with you, and you want to display a worksheet that is hidden in it. how can you do that?

Answers

The hidden worksheet can be made visible with the right click on any worksheet and select unhide.

What is a worksheet?

A worksheet in Microsoft Excel is the collection of the rows and column that has been used to organize data. The collection of worksheets is called workbook.

The hidden worksheets are not visible in the workbook, and if an individual wants to unhide the hidden worksheet, he must right-click on any worksheet and select unhide.

Learn more about worksheet, here:

https://brainly.com/question/1024247

#SPJ1

if a user watches a video with event tracking three times in a single session, analytics will count how many unique events?

Answers

Answer:

1

Explanation:

Analytics will count it a One (‘1’) Unique Event, even if a user watches a video with event tracking three times but in a single session.

Help me with this question please

Answers

Nested loop im pretty sure

When analyzing an image, you should consider composition, lighting, and

O A. sound

OB. captions

OC. quantity

OD. color

Answers

Answer:

Color

Explanation:

I think it's relatively self-explanatory. An image does not have sound, and neither captions nor quantity matter with analyzation

what word makes this inappropriate????

Answers

Hm. Maybe it’s a glitch? Maybe it thought of something dirty? :/

What could cause an external drive, like a usb flash drive, to not be recognized when plugged into a computer?.

Answers

The reasons for a flash drive being not recognized when plugged in are the drive can be corrupt or broken, the port of the computer may be broken.

What is a USB flash drive?

A USB flash drive is a drive is a small device that connect devices with computer or insert data to the computer.

A USB have capacity to hold data within, and the data can be transported to anywhere.

Thus, the reasons for a flash drive being not recognized when plugged in are the drive can be corrupt or broken, the port of the computer may be broken.

Learn more about USB flash drive

https://brainly.com/question/14144068

#SPJ1



If I want to make it look like slide number one is turning a page to slide number two, what
effect needs to be applied?

Answers

Answer:

Im not certain but I think thwir is one called flip

Explanation:

Kind of works like a book if thats what your asking for

6. After you add the printer, you need to install a utility software that allows the computer to communicate with the printer so that you can control print jobs. What is this software called

Answers

Answer:

Printer Driver

Explanation:

a printer driver or a print processor is a piece of software on a computer that converts the data to be printed to a format that a printer can understand.

How do we distinguish between remote and local information sources? give an example of each source? i'll give brainliest answer for who every answer it right

Answers

A local server means that you have a server setup on your current machine. A remote server is ran on a different machine

Other Questions
Keisha collects vintage glass marbles. Her favorite marbles have a diameter of 2.5 centimeters each. She keeps 66 of her favorite marbles in a pouch. One cubic centimeter of glass has a mass of 2.6 grams. What is the mass of the marbles in Keishas pouch rounded to the nearest gram? Use 3.14 for Reciprocal of 1/y where y not equals to 0 QUICKKK!! PLEASEThe probability of picking the winning 4-digit number in a Pick 4 lottery is 1/10000.(a) Explain what this probability means.(b) If 10000 people play the Pick 4 lottery, will exactly 1 person win the lottery? Explain.(c) The winning number in a Pick 4 lottery was 1234 two days in a row. What is the likelihood othis number occurring on the next drawing? Explain In a pet store there are a total of 25 animals 15 of the animals are dogs term is the ratio of animals that are not dogs to the total animals in the store explain the reasoning for your answer find the resistance of a multiplier connected with milliammeter of resistance 10 ohms with a deflection of 10 milliamperes and the voltage of the circuit is 15 volts A triangle has sides with lengths of 30 millimeters, 40 millimeters, and 48 millimeters. Is it aright triangle?yesno What is the value of x in this figure?O x= 30O x = 40O x = 60O I don't know. Please help me do this mathematics question experts PLS HELP I WILL GIVE BRAINIEST If triangle BCD were rotated over the y-axis from point (0, 0), what would be the coordinates of the new triangle's vertices?A.(0, -1) , (-4, -3), (-2, -1)B.(-1, 0), (-5, -2), (-3, 4)C.(1, 0), (5, 2), (3, 0)D.(1, 0), (1, -2), (-3, -4) For function f(x), which pair of limits would verify the existence of a vertical asymptote at x = 1? Who is generally considered the founder of memorial day. PLEASE HELP Explain in detail the causes and consequences of The Cold War. How did it start, what was the Cold War, and what were the results. Include some of the world events during the Cold War that almost led to a another World War. How did the Cold War finally end? You should have AT LEAST 2 causes, two events during the Cold War, as well as 2 results/consequences. Good luck! URGENT!!!!!!!!!What are the differences and similarities between cancer and an infectious disease? explain in detail. How do I find the difference -6 - (-9) Pls explain how I can do negatives and positives numbers find the length of a diagonal of a square whose side is 2 cm HELP!!!Jay borrows $8,000 at a rate of 1.9% interest per year. What is the amount due at the end of 6 years if the interest is compounded continuously?I'm confused. Pls help me god bless you The present shown below is a cube. Find the surface area. if x-y=5 and xy=4,find the value of x3-y3 Answer yes to the following questions. Follow the model.Modelo: Tienes que comprar un traje?1. Siempre vienes a este caf?2. Siempre dices la verdad?3. Pones la mesa para la cena?4. Conoces a los estudiantes?5. Haces compras por Internet?6. Sales con tus amigos hoy?7. Traes el pastel a la fiesta?8. Le das un regalo a tu amiga?9. Ves todas las pelculas nuevas?