Computers and Technology

Write a function called is_even that takes one parameter and returns a boolean value. It should return True if the argument is even; 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)

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:30, ayoismeisjuam
What are compression artifacts? 1) visible defects in the picture caused by the nature of the compression algorithm. 2) numbers that tell a web server how much to compress a picture for faster transmission. 3) invisible defects in the picture preserved by lossless compression. 4) numbers that tell a photo editing program how much to compress a picture for faster transmission.
Answers: 3
image
Computers and Technology, 21.06.2019 23:00, bankscorneliuso39
Fast sportcars the top speeds of sportscars, given in miles per hour, are: 155 mph bmw m5 217 mph lamborghini aventador spyder 205 mph ferrari 488 205 mph nissan gtr 197 mph chevrolet corvette stingray zr1 258 mph bugatti veyron supersport 195 mph dodge viper 270 mph hennessey venom 155 mph bmw m3 195 mph mercedes sl given: topspeeds=[155; 217; 205; 205; 197; 258; 195; 270; 155; 195]; carnames=string(["bmw m5" "lamborghini aventador spyder" "ferrari 488" "nissan gtr" "chevrolet corvette stingray zr1" "bugatti veyron supersport" "dodge viper" "hennessey venom" "bmw m3" "mercedes sl"]); the variable is a rectangular array. write a function called selectcars to identify cars with the top speed within a given range, and display the identified names. the selected cars speed will be in a range given by lowerbound < speed < upperbound. inputs to the function selectcars are: a column array os all car top speeds named topspeeds, the corresponding chara
Answers: 2
image
Computers and Technology, 22.06.2019 07:00, chuchi24
Robots with telescoping arms are sometimes used to perform tasks (e. g., welding or placing screws) where access may be difficult for other robotic types. during a test run, a robot arm is programmed to extend according to the relationship r = 3 + 0.5cos(4θ) and the arm rotates according to the relationship θ=−π4t2+πt , where r is in feet, θ is in radians, and t is in seconds. use a computer program to plot the path of tip a in x and y coordinates for 0 ≤ t ≤ 4s.
Answers: 2
image
Computers and Technology, 22.06.2019 19:30, ibrahimuskalel
Avariable definition defines the name of a variable that will be used in a program, as well as
Answers: 3
Do you know the correct answer?
Write a function called is_even that takes one parameter and returns a boolean value. It should retu...

Questions in other subjects:

Konu
Mathematics, 18.12.2020 21:00
Konu
Mathematics, 18.12.2020 21:00