Whose binary digits add up to an even number

Assignment Help Basic Computer Science
Reference no: EM13890920

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

Reference no: EM13890920

Questions Cloud

What can be the b2b e-commerce : What can be the B2B e-commerce in any organization/workplace/etc?
Review the balance sheet of arctic cat in appendix : 1.Review the balance sheet of Arctic Cat in Appendix A. Identify the amount for property and equipment.
Advanced understanding of a complex body of knowledge : The overall purpose of this assignment is to build your understanding of the consumer and how an understanding of consumers is a key input to the development of an effective (the right type) and efficient (minimal or no waste) marketing mix strate..
Discuss intra-familial dynamic created attachment process : Discuss the intra-familial dynamic that created the attachment process. Elaborate on whether or not that process is disruptive, dysfunctional, et cetera, as well as why you feel that way.
Whose binary digits add up to an even number : 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..
Calculate the amounts of net income and retained earnings : Effects of adjustments A bookkeeper prepared the year-end financial statements of Giftwrap, Inc. Calculate the amounts of net income and retained earnings after the preceding adjustments are recorded.
Describe how an enterprise would use 3g : Describe how an enterprise would use 3G, 4G, WWAN, and WIAMX to improve business. Explain why they would use one (1) solution over the remaining three (3).
What is the breakeven stock price at expiration? : What is the breakeven stock price at expiration?
Prepare a project plan for the unhcr : Prepare a project plan for the United Nations High Commissioner for Refugees (UNHCR) Regional Office (Australia, New Zealand, Papua New Guinea and the Pacific) for a selected sub-project within the proposed Utopia Offshore Refugee Solution (Stage ..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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