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

  Design a class numbers

Design a class Numbers that can be used to translate whole dollar amounts in the range 0 through 9999 into an English description of the number.

  Design a step by step algorithm

Design a step by step algorithm, keeping in mind the limitations of assembly language, to determine the physical address of the 3rd byte of the data segment variable LIST in the following code example.

  The program should contain a function with one of its

write a program that reads a string and outputs the number of times each lowercase vowel appears in it. the program

  Signed-magnitude representation of the similar number

Solution the question below, using the ID to identify the number you wish to specify as the correct answer. Place answer in blank provided.

  Use ethernet network data link protocols

Is possible to use Ethernet network data link protocols on a Token Ring network? Explain why or why not.

  Managing information technology projects

1.Describe how organizational culture is related to project management. what type of cultures promote a strong project? 3. Explain the four frames of organizations. how can they help project manager understand the organizational context for their pro..

  A large geographic region

A company that has 5,000+ users across a large geographic region

  Information systems manager for a small manufacturing plant

As the information systems manager for a small manufacturing plant,

  When you need to return the value of a function

In C programming: When you need to return the value of a function and you are not allowed to use the normal return value of the function, could you do it using: Call_by_val or Call_by_reference?

  Create a mount point on the current file system

In Fedora Core 4, if you need to create a mount point on the current file system, you first create a directory in the file system using the ____ command

  Give pseudocode to reconstruct an lcs from completed c table

Give pseudocode to reconstruct an LCS from the completed c table and the original sequences X = and Y = in O(m+n) time, without using the b table. Do this by writing a modified version of PRINT-LCS?

  Describe the legal requirements and ethical issues

Analyze the software tools you would use for your investigation and reasons for choosing them. Describe the legal requirements and ethical issues involved.

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