Python 3.3 keypad problem, computer science homework help

Python 3.3 keypad problem, computer science homework help

It has to be a very simple code you can use import math only and you can use dictionaries.

No long code on one line. Please send me your plan for want you’ll use. If the code was complicated I’ll withdraw the question.

Mike is an accountant. During tax season, he is required to enter a wide variety of dollar amounts to file taxes. He often has to enter the dollar amounts manually. As part of a research project, we are trying to calculate how far his fingers have to move to enter each dollar amount. He enters dollar amounts using a keypad which has the following layout:

789

456

123

. 0

On his keypad, there is a measurable distance between each of the keys. The distance between each adjacent key (horizontal or vertical) is exactly one inch. For example, the distance between the center of 7 and 4 would be one inch. The distance between 8 and 0 would be three inches.

Therefore, we can calculate the distance between each of the diagonals using the Pythagorean Theorem. The distance would be square root of
a2 +b2.Asweknowthataandbaregoingtobe1inthiscasethenweknow that the distance between each diagonal is the square root of 1+1.

For example, here is how Mike would type out the number 9851:

  1. He starts his finger at  9  and pushes the key.

  2. He moves his finger to the left 1 inch to 8 and pushes the key.

  3. He moves his finger downwards 1inch to and pushes the key.

  4. He moves his finger diagonally downwards and left sqrt(2 inches) to 1 and

    pushes the key.
    Therefore the total distance that Mike moved his finger to type in 9851 is

    1 + 1 + sqrt 2 which is about 3.41 inches.

The user will give you the the numbers and the program will provide the distance

examples:

1053.34

Distance= 11.54 inches

80121.41

Distance = 10.41 inches

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper