Question: Question 1 ( 5 points ) : Accept two integers from the user ( x and y ) . Generate and print all possible permutations

Question 1(5 points):
Accept two integers from the user (x and y). Generate and print all possible
permutations of integer values in 0,x and 0,y.
For example, if you input 2 for x, then you have numbers 0,1,2.
If you input 3 for y, then you have numbers 0,1,2,3
You are to generate all possible permutations of the (0,1,2) and (0,1,2,3)
(0,0)(0,1)(0,2)(0,3)(1,0), etc.
Question 2(10 points):
The goal of this assignment is to understand and implement a basic Run-Length
Encoding (RLE) algorithm in Python, which may be used to do compression. This
algorithm is a simple form of data encoding where sequences of the same data
value are stored as a single data value and a count. Run-Length Encoding (RLE) is
a technique that represents consecutive repeated characters (runs) as a single
character followed by the length of the run. For example, the string "aaabbcccc" can
be encoded to "a3b2c4". This coding doesn't work well if the string contains digits
too as in the case of alphanumeric strings. i.e. the 26 letter alphabet and digits.
An example of a string is aaabbcccc33335555511.
In such a case, you need to handle this by changing the code a bit and separating
the run lengths by special characters. For example, adding / between the run
lengths. The code of the above string may be: a3b2c43??4551?2.
Write a function rle_encode that takes an alphanumeric string as input and
returns its RLE encoded version. rle_encode("aaabbcccc33335555511").
This will return a code like: "a/3 b/2 c/43/45/51/2"
Write a function rle_decode that takes an RLE encoded string "a/3 b/2 c/4
3/45/51/2" and returns the original string "aaabbcccc33335555511".
Ensure your functions handle special cases, such as empty strings or strings
without any repeated characters.
Test your functions with multiple test cases to validate their correctness.
 Question 1(5 points): Accept two integers from the user (x and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!