Question: Using Python (Do not use regular expressions, no tuples, no methods of string, etc.) the following program was proposed by one of my students in

Using Python (Do not use regular expressions, no tuples, no methods of string, etc.)

the following program was proposed by one of my students in another class. He said that their company uses this question in interviews for junior QA. They don't necessarily expect candidates to write working code (I do) but just to write down the correct logic, which is what you should do before you write any code. Write a program called DeleteRuns. this is what the program does: ask user for a string (see prompt in examples below) the input can be any string. Examples: 123 1222223 122223222232222522226 axxxbyybyy 1234554321 hello 1km 1mi 1.5km 23.89mi now is the time if user enters the empty string (i.e. just press enter) the program ends and prints: goodBye! DeleteRuns is supposed to delete all adjacent repeated characters. For example: if input is: 123333 the output is 12 input: 1222342 output: 1342 input: 122233342 output: 142 if after deleting all repeated characters the resulting string has adjacent repeated characters those must be deleted too. For example: input: 1233324 output: 14 after deleting the run of 3s you would get: 1224, which itself contains a run of 2s. The final result must not have any sequence of adjacent repeated characters. Another example: input: a1234554321b output: ab Examples % DeleteRuns.py enter a string: aba aba enter a string: abcd abcd enter a string: abcc ab enter a string: abccc ab enter a string: aabc bc enter a string: aaabc bc enter a string: abbc ac enter a string: abbbc ac enter a string: aabcc b enter a string: aabbcc enter a string: xabcdeedcbay xy enter a string: goodBye!

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!