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
How buffers are used when stream a video or a music from the internet to your computer.
jekas [21]

Answer:

Restart it.

Explanation:

8 0
3 years ago
When a style set has been inserted in a document, the spacing of the style set can be easily changed.?
Stells [14]
Yes that statement is correct. 
7 0
4 years ago
With what for a human may a heatsink in the computer be compared? a crispy lettuce salad an ice cold drink of water a sizzling s
Marysya12 [62]

Answer: I'd say an ice cold drink

7 0
4 years ago
How did the use of ARPANET change computing?
Paladinen [302]

Answer:

Explanation:

PLEASE MARK BRAINLIESTPLEASE MARK BRAINLIEST

PLEASE MARK BRAINLIESTPLEASE MARK BRAINLIEST

PLEASE MARK BRAINLIESTPLEASE MARK BRAINLIEST

PLEASE MARK BRAINLIESTPLEASE MARK BRAINLIEST

PLEASE MARK BRAINLIESTPLEASE MARK BRAINLIEST

PLEASE MARK BRAINLIESTPLEASE MARK BRAINLIEST

PLEASE MARK BRAINLIESTPLEASE MARK BRAINLIEST

8 0
4 years ago
Select the correct answer.
Nutka1998 [239]

Answer:

database design is the correct e

6 0
3 years ago
Other questions:
  • If you are interested in a specific employer, but there are no job openings with the company, what steps should you take while y
    7·2 answers
  • Which were important characteristics of Sparta's government? Select the two correct answers. A. Oligarchs were able to hold a lo
    12·2 answers
  • What is Nintendo's uniqueness?​
    12·2 answers
  • Im trying to figure out how to write a program that finds prime factors of a number. I have the following but it only works for
    12·1 answer
  • Program for bit stuffing...?
    9·1 answer
  • How Do I Make A Walk animation for a school Project?? Gifs?
    13·1 answer
  • 9 Which of these words is used to begin a conditional statement? ​
    8·1 answer
  • In query design view you can add .............. to limit the number of records shown in the resulting datasheet
    13·1 answer
  • The density of mercury is 13.6 grams per cubic centimeter. Complete the steps for converting 13.6 g/cm3 to kg/m3.
    9·1 answer
  • What is the size of the rc.conf file in bytes
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!