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
The Constitution party advances a conservative approach to issues and would most likely support policies that __________.
vodka [1.7K]
The correct answer for this question is this one
reflect our basic principles." The Constitution party advances a conservative approach to issues and would most likely support policies that <span>reflect our basic principles and as well as respect whatever what we believe in.</span>
3 0
4 years ago
Create a public class Dog that stores a single double age set by the constructor. (Reject negative ages using assert.) Dog shoul
hjlf

Answer:

Explanation:

The following is written in Java and has the methods as requested in the question...

class Dog {

   private double age;

   public Dog(double v) {

       assert v >= 0:" Not valid";

       this.age = v;

   }

   public boolean isOlder(Dog dog1, Dog dog2) {

       if (dog1.age > dog2.age) {

           return true;

       } else {

           return false;

       }

   }

}

7 0
3 years ago
SOMEBODY HELP ME ASAP PLEASE AND THANK YOU
Paha777 [63]

Answer:

Isnt there another thing that is supposed to be there like some website

Explanation:

7 0
3 years ago
Read 2 more answers
How do we call a very small video,that is repeating unlimitedely
labwork [276]
A very small video that is continuous is called a GIF, which stands for Graphics Interchange Format.

 
3 0
3 years ago
Read 2 more answers
A computer with 5 stage pipeline like the one descrive in class delas with conditional branches by stalling for the next three c
trasher [3.6K]

Answer:

It hurts 80%

Explanation:

7 0
3 years ago
Other questions:
  • Which of the following is not a thing needed to make a network?
    6·2 answers
  • . What are the disadvantages of using small, fixed-length cells in ATM?
    13·2 answers
  • How do I only give 5 points and not 10?
    7·1 answer
  • Which of the following statements about the placement of illustrations in documents is true?
    12·1 answer
  • FOR ALL PLATO USERS:
    10·2 answers
  • What is the term for a media piece that is ineligible for protection by copyright laws,
    15·1 answer
  • Implement the above in c++, you will write a test program named create_and_test_hash.cc . Your programs should run from the term
    9·1 answer
  • Why would a team choose to employ a zone defense over a person to person defense?
    8·1 answer
  • If you created a variable called name, what data type would that value be?
    15·2 answers
  • What are the steps involed in accepting all the changes in a document?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!