Very simple python problem

Assignment Help Basic Computer Science
Reference no: EM13895212

VERY SIMPLE PYTHON PROBLEM

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.

Reference no: EM13895212

Questions Cloud

Provides financial assistance to several individuals : Ed provides financial assistance to several individuals. Determine whether the individuals listed qualify as dependency exemptions for Ed. Note that any dependency tests not mentioned have been met.
Assignment preparation : Assignment Preparation Activities include completing independent student reading and research. Assignment
Difference between the driving times : I randomly selected the route on 21 different days and wrote down the time it took me for the round trip, getting to work in the morning and back home in the evening.  At the .01 significance level, can I conclude that there is a difference betwee..
What are the problems with the objective evidence and cost : What are the problems with the objective evidence and cost conventions
Very simple python problem : VERY SIMPLE PYTHON PROBLEM 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:
Describe how technology impacts organizational culture : Describe how technology impacts organizational culture.
Citing specific evidence from the feudal document : John son of Hugh Poleyn enters on the land which Randolph Tailor held saving the right of everyone and gives for entry-money 4 marks and will pay 1 mark at Michaelmas in the twenty-second year of King Edward, 1 mark at Christmas next following, 1 ..
What are critical regions : How is hypothesis testing performed using t-tests? How do you write out Ho and Ha? What are the options for determining whether a hypothesis test result is significant? What are critical regions?
What is the probability the work will be complete : Jude Strohsal can't bear to see her lawn all dug up, so she has decided to visit her mother on the day the work is to be done. Jude wants to return home at 6:45 p.m. What is the probability the work will be complete when she arrives home?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Required value for the move command

Shape_index is a required value for the move command. It is the index of the shape in the shape data arrays that you wish to move. It should range between 0 and MAX_SHAPES - 1. Be sure to validate the index.

  Images can make or break a webpage

Images can make or break a webpage. It is important to place them in such a manner that they add to the website and not be a distraction. Use your favorite browser to research information about adding images to a webpage. Find one website with..

  How to implement in des

How to implement in DES?

  What purposes do cpus, memory and i-o devices

What purposes do CPUs, memory and I-O devices individually serve in a computer system

  Document for a information system transformation

4-6 pages Business Requirements Document for a Information System Transformation for a law firm and two other agencies a Security Firm; Investigation Firm all have seperate data base; I have to come up with how to create a centralized database

  Contact a local company who uses information systems

Contact a local company who uses information systems

  Which design strategy wouldyou recommend forthe construction

Assume that you are developing a new system for a local real estate agency. The agency wants to keep a database of its own property listings and also wants to have access to the citywide multiple listings service used by all real estate agents. Which..

  Creates a simple arraylist

Creates a simple ArrayList

  The lowest common ancestor

1. The lowest common ancestor. Finding of O (sqrt (N)) and O (log N) with preprocessing O (N) 2. The lowest common ancestor. Finding of O (log N) with preprocessing O (N log N) (the method of lifting the binary) 3. The lowest common ancestor. Finding..

  Each child window should contain a multiline textbox

Create an MDI Text Editor. Each child window should contain a multiline textbox. The MDI parent should have a FORMAT menu with submenus to control the size, font and color of the text in the active child window. Each submenu should have at leas..

  How might the internet impact business

How might the Internet and associated World Wide Web impact business in the United States and thereby ultimately impact the U.S. economy

  What is probability that one of students will beliving

What is the probability that one of the students will beliving on campus given that he orshe is from out of state?

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