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
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. What critical detail must she ha
Charra [1.4K]

Answer: A. target audience for the brochure.

Before even starting the design of the brochure, Amanda needs to get information on who the target audience are going to be. Amanda will need to conduct a quick research on what the audience of their community likes and does not like. By understanding the target audience, Amanda will be able to get an idea of what design, colors, and format she would make that will attract the attention of their audience.

5 0
3 years ago
PLZZZ HELP ME THIS IS THE THIRD TIME!!! BRAINLIEST AND 50 POINTS What are the advantages and disadvantages of top-down and botto
lord [1]

I would do top to down approach start from the top and work your way down to the bottom.

5 0
3 years ago
Help please if you know answer like these I’ll provide my discord.
Natasha_Volkova [10]

ins can insert a time and date.

5 0
3 years ago
How do ""night modes"" on computer screens help people fall asleep?
aleksklad [387]

Answer:

it doesn't really help people fall asleep but

Explanation:

When it gets dark, your pineal gland secretes the hormone melatonin, which tells your body to get tired and go to sleep.

5 0
3 years ago
Read 2 more answers
Which type of security measure reduces the effect of an attack by using data backups, disaster recovery plans, and the availabil
Mars2501 [29]
If I'm not mistaken firewalls should be enough as now the automatically  back up all data
4 0
3 years ago
Other questions:
  • 1. What are the biggest risks when using the public Internet as a Wide Area Network (WAN) or transport for remote access to your
    6·1 answer
  • A block style business letter is:
    5·1 answer
  • A personal computer system is composed of the processing unit, graphics board, and keyboard with reliabilities of 0.976, 0.785,
    8·1 answer
  • Which of the following refers to a technology with a three-dimensional computer simulation in which a person actively and physic
    11·1 answer
  • The automated key distribution approach provides the flexibility and dynamic characteristics needed to allow a number of users t
    8·1 answer
  • Describe three perimeter intrusion detection systems and give an example of one that you have seen deployed either at work or an
    8·1 answer
  • What should you include in a persuasive speech
    14·1 answer
  • What should you do first when designing a program?
    5·2 answers
  • What is best for a busy student to do for better results in school?
    10·2 answers
  • What is the usual price of smartphone apps?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!