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
2 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]2 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
Use ordinary pipes to implement an inter-process communication scheme for message passing between processes. Assume that there a
Naya [18.7K]

Answer:

Yup

Explanation:

6 0
3 years ago
I'm programming in javascript, I tryed to put a code like this, but it doesn't work. could someone help me?
VMariaS [17]

Answer:

Your computer does not support this code because you have put spaces in between the code, or maybe that is how you have written the question.

6 0
3 years ago
Which of the following statements best describes O*NET OnLine?
irakobra [83]

The process that aids managers to better understand the processes through which they are performed most effectively by gathering and organizing detailed information about various jobs within an organization so that is called Job analysis and is performed by a job analyst in an organization. Occupational Information Network (O*Net) is a database that provides both basic and advanced job-analysis information; as such, IT can be viewed as an alternative to conducting job analysis. O*NET OnLine has detailed descriptions of the world of work for use by job seekers, workforce development and HR professionals, students, researchers, and more. It is a tool for career exploration and job analysis.

 

 

 





8 0
2 years ago
Imagine that you only used assignment statements for the design of the seven-segment display decoder. How would you obtain the B
Basile [38]

Answer:

Please see the attached file for the complete answer.

Explanation:

Download pdf
6 0
3 years ago
With the cold winter months fast approaching, Lungi wants to improve the overall effectiveness of operations at his NGO. He want
igor_vitrenko [27]
There would not be enough blankets
5 0
1 year ago
Other questions:
  • Casual or informal group meetings are common. Here youcasually chat over tea, meet after work, or get together for purelysocial
    5·1 answer
  • Small programs called _______ are used to communicate with Paris Friel devices such as monitors printers portable storage device
    9·1 answer
  • Which of the following can indicate what careers will be enjoyable ?
    5·1 answer
  • What are all the physical components called?
    6·1 answer
  • Write a C++ program that produces a simple personalized adventure game called Lost Fortune about a band of explorers that finds
    12·1 answer
  • Your classmate is frustrated because the code that was designed to add up her five quiz grades is not working properly.
    12·1 answer
  • Hi can someone help me make a like a song for music Class pls I attached an example of what i need.
    14·1 answer
  • Why does it keep saying this when I’m putting my right credit card number
    6·1 answer
  • A central issue of public sharing is:
    13·2 answers
  • What is the output for this program?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!