Question 1. Create a program script to convert base2 numbers to base10. Test your program on...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 1. Create a program script to convert base2 numbers to base10. Test your program on the following: a) 1011001 b) 0.01011 c) 110.01001 A sample pseudocode to perform the conversion operation is given below: • Ask user to enter a base2 number. Store the result in num. • Set result = 0. • Count no of digits in num. • Starting from first digit (least significant), for each digit = 1, set result = result + 2 ^ position, where position runs from 0 to no of digits1. • Repeat until all digits are added. Note that you can modify your code so that when a point (.) is found in the entered string, resulting value has to be divided by 2 ^ (position of point counted from right). Question 1. Create a program script to convert base2 numbers to base10. Test your program on the following: a) 1011001 b) 0.01011 c) 110.01001 A sample pseudocode to perform the conversion operation is given below: • Ask user to enter a base2 number. Store the result in num. • Set result = 0. • Count no of digits in num. • Starting from first digit (least significant), for each digit = 1, set result = result + 2 ^ position, where position runs from 0 to no of digits1. • Repeat until all digits are added. Note that you can modify your code so that when a point (.) is found in the entered string, resulting value has to be divided by 2 ^ (position of point counted from right).
Expert Answer:
Answer rating: 100% (QA)
Python def binarytodecimalbinarystr result 0 haspoint False position 0 for digit ... View the full answer
Related Book For
Fundamental Accounting Principles Volume 1
ISBN: 9781259259807
15th Canadian Edition
Authors: Kermit Larson, Tilly Jensen, Heidi Dieckmann
Posted Date:
Students also viewed these programming questions

Is your course instructor a manager? Discuss in terms of planning, organizing, leading, and controlling. Also discuss using Mintzbergs managerial roles approach.

Is your course instructor a manager? Discuss in terms of managerial functions, managerial roles, and skills.

Course evaluation ratings for four college instructors are shown in the following table. Use = .05 and test for a significant difference among the rating for these instructors. What is your...

Learning by doing is an integral part of the course experience albeit online. The intent of this assignment is for you to demonstrate your ability to apply course content. Thus in the Marketing...

"When the yield curve is upward sloping, the fixed rate on a multiyear swap must be higher than the current level of LIBOR. With a downwardsloping yield curve, the opposite will occur." Explain what...

A random sample of 50 families reported the dollar amount they had available as a liquid cash reserve. The data have been put in the following frequency table: (a) Construct a histogram of the...

Almetals, Inc., a Michigan company, entered into a contract with the German firm Wickeder Westfalenstahl regarding the purchase of clad metal, a specialty metal used in a variety of industries but...

Scully Corporations comparative balance sheets are presented below. Additional information: 1. Net income was $22,630. Dividends declared and paid were $19,500. 2. All other changes in noncurrent...

Identify the entities and the relationships the diagram given below Translate the Diagram Into Relational Model Fname Minit Lname San Bdate Sex No Street Apt no City State Zip Name PERSON Address...

The proposed rates were not in the range the CEO expected given the pricing analysis. The CEO has asked the pricing actuary to verify the total projected loss cost excluding potential large storm...

(a) You need to pay off a car loan within the next two years. The payment will be $4,000 every month. Today you have made a single deposit into a returnguaranteed investment account that will allow...

What are group norms?

In what specific ways do stability and/or renewal strategies apply to Starbuckss in recent years?

Workplace inclusivity is arguably one of the most notable HR issues of this decade. How do you think managers should tackle an offensive or hostile work environment?

What is Starbucks doing to sustain its competitive advantage over competitors? What else might they do to continue to be competitive relative to others in their industry?

Describe the different types of training. How do organizations provide each type of training?

Suppose a severe blight causes a sharp reduction in the coffee harvest while demand for the beverage remains stable. Draw diagrams (properly labelled) to illustrate the following: The impact on the...

Audrey purchases a riding lawnmower using a 2year, nointerest deferred payment plan at Lawn Depot for x dollars. There was a down payment of d dollars and a monthly payment of m dollars. Express...

Use the information given and the analysis completed in Exercise 25. Exercise 25 William Curtis is a personal finance expert and owns Much Money Consulting. This is his first month of operations...

Identify and explain the criteria that must be met before recording accounts receivable and revenue.

MY Auto bodys adjusted trial balance on December 31, 2017, appears in the work sheet as follows: Required 1. Prepare closing entries. 2. Prepare the postclosing trial balance at December 31, 2017....

Evaluate the following drafts. What parts should be omitted? What needs to be changed or added? What parts would benefit from specific supporting details? 1. Dear_ There is more to a buyer's job than...

Use five different websites to investigate three companies in your career field. Look at salary guides for your level of qualifications, product/service information, news articles about the...

Interview someone working in a field youre interested in. Use the following questions to get started: How did you get started in this field? What do you like about your job? What do you dislike...
Study smarter with the SolutionInn App