Easy python codean evil number is a positive integer whose


EASY PYTHON CODE!

An evil number is a positive integer whose binary digits add up to an even number (the opposite of an evil number is an odious number, whose binary digits add up to an odd number).

For example, 14 is odious:

14 (base 10) = 1110 (binary)

1 + 1 + 1 + 0 = 3, which is odd.

17, on the other hand, is evil:

17 (base 10) = 10001 (binary)

1 + 0 + 0 + 0 + 1 = 2, which is even.

Write a small Python program that prompts the user to enter an integer and prints whether that number is evil or odious.

HINT: You may want to write a helper function to translate the input into binary before beginning your analysis.

Sample Program Execution

(Program output is in italics, while user input is bold)

Execution 1:

Please enter a number: 23

This number is evil.

Execution 2:

Please enter a number: 25

This number is odious.

Program must prompt for user input, correctly identify evil numbers, and odious numbers

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Easy python codean evil number is a positive integer whose
Reference No:- TGS01184167

Expected delivery within 24 Hours