[Solved] Ransom

30 $

File Name: Ransom.zip
File Size: 56.52 KB

SKU: [Solved] Ransom Category: Tag:

Or Upload Your Assignment Here:


https://www.youtube.com/playlist?list=PLhOuww6rJJNMxWhckg7FO4cEx57WgHbd_

Write a program that will randomly capitalize the letters in a given piece of text a la a ransom note. The text may be provided on the command line:

$ ./ransom.py 'The quick brown fox jumps over the lazy dog.'THe qUICk BrOWn fOX jumPS OVEr THE LAzy DOg.

Or with a file:

$ ./ransom.py ../inputs/fox.txtTHE QUicK BRown fox JuMPS OVER THe laZY dog.

Given no arguments, the program should print a brief usage:

$ ./ransom.pyusage: ransom.py [-h] [-s int] strransom.py: error: the following arguments are required: str

The program should accept a -s or --seed option to use as a random seed to ensure reproducibility:

$ ./ransom.py -s 1 ../inputs/fox.txtthE QUICk BrOWn Fox jumpS OveR tHe LAzY dOg.

It should respond to -h and --help with a longer usage:

$ ./ransom.py -husage: ransom.py [-h] [-s int] strRansom Notepositional arguments:  str                 Input text or fileoptional arguments:  -h, --help          show this help message and exit  -s int, --seed int  Random seed (default: None)

Run the test suite to ensure your program is correct:

$ make testpytest -xv test.py============================= test session starts ==============================...collected 6 itemstest.py::test_exists PASSED                                              [ 16%]test.py::test_usage PASSED                                               [ 33%]test.py::test_text1 PASSED                                               [ 50%]test.py::test_text2 PASSED                                               [ 66%]test.py::test_file1 PASSED                                               [ 83%]test.py::test_file2 PASSED                                               [100%]============================== 6 passed in 0.62s ===============================

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Ransom
30 $