Whose binary digits add up to an even number

Assignment Help Basic Computer Science
Reference no: EM13890920


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

Reference no: EM13890920

Examine the proposed business ethical problem

Examine the proposed business ethical problem that the Brazilian Federal Data Processing Service is presently experiencing. Determine whether you agree or disagree that Braz

Initial radioisotope power supply

A satellite has an initial radioisotope power supply of 70 watts (W). The power output in watts is given by P = 70e-t/250 where t is the time in days. Solve for t to find th

Present opportunities for a workforce leader

What is diversity? What graphic model, drawing, picture, google link, verse or ‘famous quotation,' etc. captures your definition of diversity? Does "diversity" present opp

Which industrialization essentially made us less independent

Many experts assert which industrialization has essentially made us less independent and more closely related to other people than ever before.

Effective measure of living standards

1. What economic factors are taken into account when measuring GDP? 2. What makes GDP an effective measure of living standards? 3. How might quality-of-life measures be determ

Political parties serve an important role

Political parties serve an important role in U.S. democracy, as they allow individuals with similar viewpoints to work together to shape public policy. For the most part, the

Find the distance from the point

find the distance from the point (1 2 3) from each of the following 1) the line of intersection of the plane p1 x-2y-3z=4 and p2 ; 2x-y +5z=1 2) the plane perpendicular to t

Explain what the tradeoffs are in using a marker-column

Modify the database by adding an additional column ("Deleted_Date") to those tables that represent entities that could contain data which can be deleted and justify your ratio


Write a Review

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd