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
MissTica
3 years ago
11

Write a function called is_even that takes one parameter and returns a boolean value. It should return True if the argument is e

ven; 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)
Computers and Technology
1 answer:
Nikitich [7]3 years ago
6 0

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.

You might be interested in
What is a full featured word processing program that allows you to create many types of personal and business document.
miskamm [114]
B) Word is the answer
3 0
3 years ago
What is token passing?
Flauer [41]

Answer:

Answer is A network access method that avoids the possibility of data collisions.

Token Ring is the precursor to Ethernet and CSMA/CD to avoid packet collisions.

Explanation:

8 0
4 years ago
Which of the following would a cyber criminal most likely do once they gained access to a user id and password
Bogdan [553]

Answer:

do something wrong as you

3 0
3 years ago
In a stream channel what is deposited first?
asambeis [7]
Gravel sized particles
6 0
3 years ago
3. with a dui charge on a driver’s record ______________. a. the price of his or her insurance greatly increases b. he or she ma
djyliett [7]
<span>The answer to your question is D. both A and C</span>
7 0
3 years ago
Other questions:
  • PLS HELP!!
    13·1 answer
  • Using numerous computers to inundate and overwhelm the network from numerous launch points is called a(n) ________ attack.
    9·1 answer
  • What determines the keystroke to open a cmos editor? how can you find this information?
    15·1 answer
  • When the atmosphere has too much carbon dioxide in it, the oceans absorb some of it to achieve a new balance. This is an example
    9·2 answers
  • Don is visiting digital stores and searching the internet to learn about high-definition DVD players before he buys one. This is
    8·1 answer
  • _____ creates a border or space that separates information.
    14·1 answer
  • Fill this blanks with the given words​
    6·1 answer
  • Imagine that you just received a summer job working for a computer repair shop one of your first task is to take apart a compute
    14·1 answer
  • True or False? Popular sites are always mean accurate.
    14·2 answers
  • A company is looking for an employee to help organize customer information for the sales team. Which computer field includes thi
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!