Write a function called is_even that takes one parameter and returns a boolean value. It should return True if the argument is even; it should return False otherwise.

The is_even function should not print anything out or return a number. It should only take in a number and return a boolean.

Note: Be sure to include comments for all functions that you use or create.

For example, if you made a call like

is_even_number = is_even(4)
is_even_number should have the value True.

Once you’ve written this function, write a program that asks the user for integers and prints whether the number they entered is even or odd using your is_even function. You should let the user keep entering numbers until they enter the SENTINEL value.

Here is a sample run of the program:

Enter a number: 5
Odd
Enter a number 42
Even
Enter a number: -6
Even
Enter a number: 0
Done!

(CODEHS, PYTHON)

Answers

Answer 1

def is_even_number(n):

   return True if n % 2 == 0 else False

while True:

   number = int(input("Enter a number: "))

   if number == 0:

       break

   else:

       if is_even_number(number):

           print("Even")

       else:

           print("Odd")

I wrote my code in python 3.8. I hope this helps.


Related Questions

How to format each dictionary item as a text string in the input file. How to covert each input string into a dictionary item. How to format each item of your inverted dictionary as a text string in the output file.

Answers

Answer:

- To get the items of a dictionary and print them as a string, use the items() method to unpack the keys and values in a for and print or write them into a file.

for key, value in mydict.items():

   print(f"{key}, {value}")

- To convert string from user input into dictionary;

   mystring = input().split(" ")  #assuming the words are separated by a space.

   from word in mystring:

       mydict[word] = mydict.get(word, 0) + 1

This would use the words in the string as the keys of the dictionary and the count of each word as the respective values.

Explanation:

A dictionary is a data structure in python used to store data in key-value pairs. The items are enclosed in curly braces and can be accessed with the key in dot or bracket notation.

Dictionaries in Python are used to represent data items in pairs; i.e. key and values

(a) Format items as strings in an input file

To do this we make use of the file manipulation.

Assume the dictionary name is given as: myDict

See attachment for the complete solution

Read more about Python dictionary at:

https://brainly.com/question/14353514

Fix the infinite loop so that it counts from 3 down to 1.public class Loop1{public static void main(String[] args){int x = 3;while (x > 0){System.out.println(x);}}}

Answers

Answer:

Include x-- right after the print statement

Explanation:

Given:

The above lines of code

Required

Edit to countdown from 3 to 1

The above code (as it is) prints 3 in infinite times. To make it countdown to 1, we simply include a decrement operation.

Initially, the value of x is 3: int x = 3;

And the condition is that the loop is to be repeated as long as x > 0

All we need to do is to include x-- right after the print statement.

This  operation will reduce the value of x on every iteration as long as the condition is true.

Hence, the complete code is:

public class Loop1{

   public static void main(String[] args){

       int x = 3;

       while (x > 0){

           System.out.println(x);

          x--;

       }}}

Write a list comprehension statement to generate a list of all pairs of odd posi

Answers

Answer:

Print([(a,b) for a in range(10) for b in range(10) if (a < b and a%2 == 1 and b%2 == 1)])

Explanation:

Here, we declared a range of value for a and b using a for loop and the range function. The values are the first 10 numeric digits. The we used the if statement to establish our constraints;

In other to ensure that ;

Lower digit is written first ; (a < b) ;

Only odd numbers are considered,

a%2 == 1 ; b%2 == 1 (remainder when a and b are divided by 2 is 1.

Both a and b are declared as a tuple in other to obtain a pair of odd values.

Recently, Walmart offered a wireless data contract based on bandwidth used, with a minimum monthly charge of $42 for up to 5 gigabytes (GB) of use. Additional GB can be purchased at the following rates: $12 for an additional 1 GB, $28 for an additional 3 GB, and $44 for a capacity of 10 GB. What is the cost for a user who is expecting to use 9 GB

Answers

Answer:

For 9GB of data the user would pay $82 monthly!

Explanation:

To start off, our end goal is 9GB. We have the equation 9 = ? We can add up to our solutions with 1GB, 3GB, and 10GB. We can immediately rule out 10GB, since 9GB ≠ 10GB. To cost the least amount of money we can add up             3GB and 1GB = 4GB + 5GB = 9GB!

So, our equation is 3GB + 1GB + 5GB = 9GB, now lets figure out the cost!

                                $28 + $12 + $42 = $82

For 9GB of data the user would pay $82 monthly!

Hope this Helps! :)

Have any questions? Ask below in the comments and I will try my best to answer.

-SGO

Which of the following methods can be used to solve the knapsack problem?

a. Brute Force algorithm
b. Recursion
c. Dynamic programming
d. All of the mentioned

Answers

Answer: D. All of those mentioned

Explanation:

The knapsack problem is a problem that typically occurs in combinatorial optimization and is also a 2D dynamic programming example.

We should note that all the methods given in the option such as recursion, brute force algorithm and dynamic programming can all be used to solve knapsack problem.

Therefore, the correct answer is D.

please help

Write a method that takes 5 ints as parameters and returns the average value of the 5 ints as a double.

This method must be named average() and it must have 5 int parameters. This method must return a double.

Calling average(1, 5, 7, 4, 10) would return 5.4.

Answers

Answer:

Answered below

Explanation:

This solution is written in Kotlin programming language.

fun average (a: Int, b: Int, c: Int, d: Int, e: Int) : Double {

#variable to hold the addition of all parameters

var sum = a + b + c + d + e

#variable to hold the average of sum

var avg = sum / 5

return avg

}

#call the function to see how it works.

# this operation is done in the fun main()

var test: Double = average ( 5, 4, 7 , 3, 9)

print (test)

How many minutes are there from 8:00 am to 1:00 pm?

Answers

Well it’s 5 hours so you take 5 times 60m for each hour and you get 300m

Answer:300 minutes

Explanation:

from 8 to 1 is 5 hours so you do 5*60= 300

A counter is ?

A. used only outside of the loop

B. none of the above

C. a variable used in a loop to count the number of times an action is performed

D. A person with a pen and paper

Answers

Answer: In digital logic and computing, a counter is a device which stores (and sometimes displays) the number of times a particular event or process has occurred, often in relationship to a clock. The most common type is a sequential digital logic circuit with an input line called the clock and multiple output lines.

Which 2 problems does the Pay down credit card workflow solve for clients? (Select all that apply) It helps clients stay on top of making payments on time It ensures that payments to credit card accounts are categorized correctly It provides a lower rate than most credit cards to qualified small businesses It uses language that non-accountants can understand

Answers

Answer:

B. It ensures that payments to credit card accounts are categorized correctly

D. It uses language that non-accountants can understand

Explanation:

Pay down credit card workflow is a new feature that makes entering records in QuickBooks easier for users. The two prime benefits of this workflow are;

1. It ensures that payments to credit card accounts are well categorized well. Without this feature, users most times find it difficult to enter records correctly or they tend to duplicate entries. This new feature obtains vital information that helps the software to correctly credit the accounts.

2. It uses language that non-accountants can understand. This simplifies the process and makes it easier for the user to enter the right data that would help the software to correctly credit the accounts.

discuss how sentiment analysis works using big data?

Answers

Answer:

sentiment analysis is the process of using text analytics to mine various of data for opinions. often sentiment analysis is done on the data that is collected from the internet & from various social media platforms.

What will the output of the statements below? System.out.println(9%2); System.out.println(12%6); The output of the first statement is * The output of the second statement is​

Answers

Answer:

You get Exact 30 print of that sentence on a comadore 64

Explanation:

Just simple basic science. hope this helps

what security issues could result if a computer virus or malware modifies your host file in order to map a hostname to another IP address

Answers

Answer:

Man-in-the-middle attack

Explanation:

In this type of attack, the hacker uses the virus or malware to get and change his IP address and hostname to match the address and hostname of the target host computer. The allows the hacker to gain access to information sent to the target IP address first.

What is the output of the following program

#include

int toronto (int x)

{

int w;
if (x == 0) w = 1; else w = toronto (x-1);
return (w);
}
int main (void)
{
int a = 2;
printf ("%d", toronto (a));
return (0); }

a. 0
b. 1
c. 2
d. -1
e. none of these

Answers

Answer:

The output is 1

Explanation:

Analysing the flow of program (We start from the main method)

The main begins here

int main (void) {

This line declares a as integer and also initializes it to 2

int a = 2;

This line passes 2 to the function names toronto and also prints the result of the function

printf ("%d", toronto (a));

return (0); }

The toronto function begins here.

Note that the function receives 2 as its argument and this is saved in variable x

int toronto (int x) {

This declares w as integer

int w;

If x is 0, w equals 1

if (x == 0) w = 1;

If otherwise

else

This reduces x by 1 and performs a recursion

w = toronto (x-1);

return (w);

}

Because of the structure of the if condition in the toronto function, the function will be repeated until x is 0.

And when x = 0; w = 1

This returns w (i.e. 1) back to the main function where 1 is printed as the output

return (w);

what type of device is a projector ?
a. input
b. memory
c. output
d. storage

Answers

Answer:

output

Explanation:

if I'm wrong sorryyy

Answer:

Output

Explanation:

:D

Which of the following statements is true when it comes to developing a web presence for a business?

Answers

Explanation:

Customers can learn about a business by downloading a mobile app, but they can’t place an order using an app

 

Building a new website requires a large budget

Question 57 Which type of application attack would include User denies performing an operation, attacker exploits an application without trace, and attacker covers her tracks

Answers

Answer:

Auditing and logging

Explanation:

Auditing and logging is a form of application threats and attacks that an application security is susceptible to. It involves a user denies performing an operation; attacker exploits an application without trace, and at the same time attacker covers his or her tracks.

To prevent this, an Auditing and logging countermeasure should be put in place of application security to guide against such aforelisted threats and attacks before its actual occurrence.

Therefore, in this case, the correct answer is "Auditing and logging."

java Elements in a range Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain fewer than 20 integers. That list is followed by two more integers representing lower and upper bounds of a range. Your program should output all integers from the list that are within that range (inclusive of the bounds). For coding simplicity, follow each output integer by a comma, even the last one. The output ends with a newline. Ex: If the input is: 5 25 51 0 200 33 0 50 then the output is: 25,0,33, (the bounds are 0-50, so 51 and 200 are out of range and thus not output). To achieve the above, first read the list of integers into an array.

Answers

Answer:

The program in Java is:

import java.util.Scanner;

public class MyClass {

   public static void main(String args[]) {

     Scanner input = new Scanner(System.in);

     int n;

     n = input.nextInt();

     int [] mylist = new int[n+1];

     mylist[0] = n;

     System.out.print("List elements: ");

     for(int i = 1;i<n+1;i++){

         mylist[i] = input.nextInt();

     }

     int min,max;

     System.out.print("Min & Max: ");

     min = input.nextInt();

     max = input.nextInt();

     

     for(int i=1; i < mylist.length; i++){

         if(mylist[i]>=min && mylist[i]<=max){

             System.out.print(mylist[i]+" ");

 }

}

   }

}

Explanation:

This line declares length of list

     int n;

This line gets length of list

     n = input.nextInt();

This line declares the list/array

     int [] mylist = new int[n+1];

This line initializes the element at index 0 to the length of the list

     mylist[0] = n;

This prompts user for elements of the list/array

     System.out.print("List elements: ");

The following iteration gets list elements

     for(int i = 1;i<n+1;i++){

         mylist[i] = input.nextInt();

     }

This declares the lower and upper bound (min, max)

     int min,max;

This line prompts user for elements of the list/array

     System.out.print("Min & Max: ");

This next two lines get the bound of the list/array

     min = input.nextInt();

     max = input.nextInt();

The following iteration prints the elements in the range

     for(int i=1; i < mylist.length; i++){

         if(mylist[i]>=min && mylist[i]<=max){

             System.out.print(mylist[i]+" ");

 }

}

How many total beats are these tied notes worth, assuming a quarter note equals 1 beat?
A. One
B. Five
C. Three

Answers

Answer:

one i think

Explanation:

The _____ Tag surrounds all content that will be visible on your web page for all to users to see on that website.

Answers

Answer:

The body tag

Explanation:

HTML has several tags; however, the tag that handles the description in the question is the body tag.

It starts with the opening tag <body> and ends with closing tag </body>

i.e.

<body>

[Website content goes in here]

</body>

Any text, image, object etc. placed within this tag will be displayed in the website

She can't part.....her jewels.​

Answers

Answer:

She can't part with her jewels.

Explanation:

:))))

Karin realized that a song takes up a lot more space on her computer than the lyrics of the song typed out in ms word document . Why does this happen

Answers

Consider that there are many different components of one file such as a song rather than a word document of typed words. Research the components of why this song takes up space on a computer.

NEED HELP WILL MARK BRAINLIEST AND 25 POINTS FOR ANSWER Which statement best describes a characteristic of a relational database?

It contains tables that are completely independent of one another.

It contains tables with fields that are associated with one another.

It is a feature that is primarily used to navigate databases.

It is a feature that is primarily used to add queries to tables.

Answers

The relational database has the characteristic feature of the adjoining of data with one another.

What is a relational database?

The relational database is given as the interconnection of the data with the digital database management system.

The relational database is given with the characteristics of the adjoining of data tables and fields associated with one another. Thus, option B is correct.

Learn more about relational database, here:

https://brainly.com/question/13262352

#SPJ2

Which are the steps in the process of creating a database

Answers

Answer:

Determine the purpose of your database. ...

Find and organize the information required. ...

Divide the information into tables. ...

Turn information items into columns. ...

Specify primary keys. ...

Set up the table relationships. ...

Refine your design. ...

Apply the normalization rules.

Answer:

identifying fieldnames in tables

defining data types for field names

Explanation:

sorry I'm late. future Plato users this is for you

please help me please help me.​

Answers

Answer:

dont know man thanks for points tho

but it is 209

Explanation:

we need to send 254 kbps over a noiseless channel with a bandwidth of 15 khz. how many signal levels do we need

Answers

Answer:

The level of the signal is 353.85

Explanation:

Data rate determines the speed of the data transmission.

The data rate depends on the following factors

The available bandwidthnumbers of signal levelsthe quality of the channel ( Means the level of noise )

The data is transmitted either from a noiseless channel or a noisy channel.

The given quality of the channel in the question is noiseless.

Use the following formula to calculate the signal levels

Bit rate = 2 x bandwidth x [tex]Log_{2}[/tex] ( signal level )

where

Transmitted Data = 254 kbps = 254,000 bps

Bandwidth = 15 khz = 15,000 hz

Placing values in the formula

254,000 = 2 x 15,000 x [tex]Log_{2}[/tex] ( L )

254,000 = 30,000 x [tex]Log_{2}[/tex] ( L )

254,000 / 30,000 = [tex]Log_{2}[/tex] ( L )

8.467 = [tex]Log_{2}[/tex] ( L )

L = [tex]2^{8.467}[/tex]

L = 353.85 levels

Choose the type of collection created with each assignment statement

____ collection A = {5:2}
Options: tuple, dictionary, list

____ collection B = (5,2)
Options: tuple, dictionary, list

____ collection C = [5,2]
Options: tuple, dictionary, list

Answers

Answer:

dictionary

tuple

list

Explanation:

. Else-if is good selection statement that help us to solve problems in C++,mostly times same problem of same nature can also be solved via switch statement. Which one you prefer to use and why?

Answers

Answer:

Else-If statements

Explanation:

Personally, I prefer using Else-If statements for conditional statements since you can start with and If statement and add to it if necessary. Aside from this, Else-If statements also allow you to add more than one condition to be met by using tags such as and or and not. Switch statements are better in scenarios where you have a set of possible inputs or results and need a specific event to happen for each input/result, but this is not as common of a scenario so Else-If is usually my go-to conditional statement.

Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outpu

Answers

Answer:

Explanation:

The following program is written in Java and is a function that asks the user for an input and keeps doing so until a negative value is entered, in which case it calculates the average and max values and prints it to the screen.

public static void average () {

                       int num;

                       int sum = 0;

                       Scanner in = new Scanner(System.in);

                       System.out.println("Enter Number");

                       num = in.nextInt();

                       int count = 0;

                       int max = 0;

                       while(num >= 0)

                       {

                               sum+=num;

                               System.out.println("Enter Number");

                               num = in.nextInt();

                               count++;

                               if(num>=max){

                                       max = num;

                               }

                       }

               System.out.println(sum/count);

               System.out.println(max);

               }

Answer:hi

Explanation:

please help me



Match the technology with the appropriate task.



1. graphics software

2. word processor

3. CAD

4. laptop

5. GPS​

Answers

Complete Question:

Match the technology with the appropriate task.

Column A

1. Graphics software

2. Word processor

3. CAD

4. Laptop

5. GPS

Column B

A. Create a company logo.

B. Get directions to a customer’s office.

C. Type a report.

D. Complete many types of tasks on a computer away from the office.

E. Design a building.

Answer:

1. A

2. C

3. E

4. D

5. B

Explanation:

1. Graphics software: it can be used to create a company logo. Some examples of software applications or programs are Adobe photoshop, Core-draw, illustrator etc.

2. Word processor: it is typically used for typing a text-based document. For instance, type a report. Some examples are notepad, Microsoft Word, etc.

3. CAD: design a building. CAD is an acronym for computer aided design used for designing the graphical representation of a building plan. An example is Auto-CAD.

4. Laptop: complete many types of tasks on a computer away from the office. A laptop is compact and movable, so it can be easily used in any location.

5. GPS: directions to a customer’s office. GPS is an acronym for global positioning system and it is typically used for locating points and directions of a place.

Answer:

1. A

2. C

3. E

4. D

5. B

True or false: In relational databases, each individual space within a row or column contains exactly one value.

Answers

Answer:

True.

Explanation:

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

A data dictionary can be defined as a centralized collection of information on a specific data such as attributes, names, fields and definitions that are being used in a computer database system.

In a data dictionary, data elements are combined into records, which are meaningful combinations of data elements that are included in data flows or retained in data stores. This ultimately implies that, a data dictionary found in a computer database system typically contains the records about all the data elements (objects) such as data relationships with other elements, ownership, type, size, primary keys etc. This records are stored and communicated to other data when required or needed.

Basically, when a database management system (DBMS) receives data update requests from application programs, it simply instructs the operating system installed on a server to provide the requested data or informations.

A relational database can be defined as a type of database that is structured in a manner that there exists a relationship between its elements.

Hence, in relational databases, each individual space within a row or column contains exactly one value.

Other Questions
Max sold one third of his old stamps to buy 6 new stamps. He now has 15 stamps. How many did he start with? .. What event was responsible for the first population explosion? (1 point)a the Industrial Revolution b the invention of fire c the Agricultural Revolution d the development of cities Pls pls help I dont have time HELP ASAP. It also detects if its right or wrong. Solve for the variableeeeee plzzz How are food webs and food chains related? HELP IF YOU WANT BRAINLEIST!!Food webs only contain consumers.Food webs consist of only one food chain.Food webs are made of many food chains.Food webs only contain producers. Based on the map, why do you think people in Southern Europe historically have found sea travel easier than overland travel?Select one:a. The shape of the region's landmasses make sea travel difficult.b. There is easy access to the sea because of the shape of the region's landmasses.c. The three peninsulas are covered with rugged mountains so land travel is preferred.d. The mountains make overland travel easy. How were salt and sugar represented differently in the simulation? I need help with this please what is the the constant of proportionalityX: 0 2 4 6Y: 0 3 6 9 An item is regularly priced at $43. Charmaine bought it at a discount of 95% off the regular price. How much did Charmaine pay? Please answer asap!!!!!!!!!!!!!!!!!!!!!!!!! Which expressions have a value of 49 when w = 4? Choose the correct answers and show your work.A) 3w2+ 25B) 7(w2- 9)C) w3/8+ 41 What's the definition of absoulute dating 8. What is the 10th term of the geometric sequence a(n)= -3(2)^x-1 a. -54b. -3,072c. -10,077,696d. -1,536 Find (f+g)(x) and (f-g)(x) f(x)=2x+7 g(x)=5x-4 Describe the relationship between the two quantities. WILL GIVE BRAINLIEST NO JOKE ANSWERS PLEASE.. what is h ( t ) = t ( 16 t + 7 ) in standard formPLEASE HELP !!!! Some estimates indicate that corporate crime may cost society more than $389 billion dollars each year.TrueFalse As Asian religion based on the teachings of Buddha.A.) HinduismB.) BuddhismC.) AryansD.) ZoroastrianismPlease answer or my teacher will eat me PLEASE HELP ITS DUE TODAY AND I DONT KOW ITS FOR 10PTSS Making the Most of MucusJust the name itself will make you giggle. It's a great word that conjures visions of slime and unpleasantness. It is perhaps the most annoying part of having a cold or allergies. Mucus, however, plays a very important role in defense of our bodies and our health. In fact, it's high time mucus got a lot more respect.First, there are some amazing facts about mucus that are worthy of respect. Humans produce about a liter of mucus every day, whether they are sick or not. Bony fish and some invertebrates (snails or slugs) also have mucus cells on the outside of their body. This external mucus creates a protective coating that prevents predators' toxins from doing harm. Humans produce mucus to protect our stomachs, our lungs, and several other systems.We tend to not like mucus because it is a considered a symptom or sign that something is wrong. We usually only see it when we are sick, and so we tend to dislike it. According to Michael M. Johns, III, MD, however, "mucus is incredibly important for our bodies." Johns, an assistant professor at Emory University, calls mucus "the oil in the engine" of our bodies. Without mucus, our engines, or bodies, would freeze up and stop working properly.Furthermore, mucus is not just the nasty gunk you see when you are sick. It lines the tissues in your mouth, your nose, throat, and lungs. It also is crucial in protecting your digestive system. Mucus puts a protective coating over the surfaces of these tissues, keeping them moist. Most of the time we don't notice mucus is making our lives better. It does its job quietly, making everything run smoothly, keeping our inner tissues soft and flexible enough to fight off invaders.Occasionally, though our mucus-making membranes go into overdrive. If you eat a hot pepper, your mucus membranes in your mouth and throat start producing extra mucus to protect you. If you come into contact with pollen, you may get a runny nose and start sneezing and coughing. When these things happen, your mucus systems start making more fluids to wash away the irritating particles. Mucus also has some antibodies that increase our ability to fight off bacteria and viruses.It's hard to appreciate what is essentially slime, but we have mucus for some very good reasons. It helps to keep us healthy and lets us know when our bodies are under attack. We would be wise to respect what our bodies do to keep us safe. So the next time you find yourself reaching for a tissue, remember mucus is your friend and ally.Which line from the text explains people's attitude about mucus? (1 point) aIf you eat a hot pepper, your mucus membranes in your mouth and throat start producing extra mucus to protect you. bHumans produce mucus to protect our stomachs, our lungs, and several other systems. cWe tend to not like mucus because it is a considered a symptom or sign that something is wrong. dIt does its job quietly, making everything run smoothly, keeping our inner tissues soft and flexible enough to fight off invaders.