https://www.youtube.com/playlist?list=PLhOuww6rJJNNd1Mbu3h6SGfhD-8rRxLTp
Write a program that will encode any number in a given string using an algorightm to jump the five on a standard US telephone keypad such that 1 becomes 9, 4 becomes 6, etc. The 5 and the 0 will swap with each other. Here is the entire substitution table:
1 => 92 => 83 => 74 => 65 => 06 => 47 => 38 => 29 => 10 => 5
Encode only the numbers and leave all other text alone:
$ ./jump.py 867-5309243-0751
If given no arguments, present a brief usage:
$ ./jump.pyusage: jump.py [-h] strjump.py: error: the following arguments are required: str
Respond to -h
or --help
with a longer usage:
$ ./jump.py -husage: jump.py [-h] strJump the Fivepositional arguments: str Input textoptional arguments: -h, --help show this help message and exit
Run the test suite to ensure your program is working correctly:
$ make testpytest -xv test.py============================= test session starts ==============================...collected 4 itemstest.py::test_exists PASSED [ 25%]test.py::test_usage PASSED [ 50%]test.py::test_01 PASSED [ 75%]test.py::test_02 PASSED [100%]============================== 4 passed in 0.53s ===============================
Reviews
There are no reviews yet.