I need to code a program that input will be any random string and the the output will include processes, unprocessed string.
EX:
Input String : XYZZXXYYXYZZXYZ
Unique Prefixes :
Encode List : [(0, 'X'), (0, 'Y'), (0, 'Z'), (3, 'X'), (1, 'Y'), (2, 'X'), (2, 'Z'), (4, 'Y'), (3, '')]
Encoded Binary String : 00101100000101100100010110101101011000001010110010100101100000100101101001000101100100011
Decoded String : XYZZXXYYXYZZXYZ
If anyone can help me with this. I am very thankful and appriciated.
Whoever90
0
Newbie Poster
Recommended Answers
Jump to PostWith the encoded text, I would go with dictionary rather than tuples.
As for the prefix stuff, try split.('sting')
for the unique prefixes take a look at itertools
More spacificalyitertools.permutation(string)
Jump to PostHow do you get from here
Input String : XYZZXXYYXYZZXYZto here (and what happened to the final "Z")
Unique Prefixes :to here [and is (3,'') the final Z]
Encode List : [(0, 'X'), (0, 'Y'), (0, 'Z'), (3, 'X'), (1, 'Y'), (2, 'X'), (2, 'Z'), (4, …
All 6 Replies
Tech B
48
Posting Whiz in Training
woooee
814
Nearly a Posting Maven
Whoever90
0
Newbie Poster
nezachem
616
Practically a Posting Shark
Whoever90
0
Newbie Poster
Whoever90
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.