Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write code that takes a string and a list of substrings, each with a length of three. Please use TWO WHILE LOOPS to solve this

Write code that takes a string and a list of substrings, each with a length of three. Please use TWO WHILE LOOPS to solve this problem, and NOT a "for" loop,or just one while loop. Return True or False depending on whether the strings contains any of the substrings. For example, if the string was happybirthday, and the list of substrings was ['hay', 'pyr', 'bir', 'hdy'], your code would return True. Do NOT use the in keyword. You may NOT use any built-in functions/methods besides len() and .append().

Here is the link to my code so far in the python visualizer, please modify it such that it meets the conditions above.

https://goo.gl/dsN73z

Here is the error message I'm getting so far in command prompt for my code, if it helps you put things into perspective in regards to the test cases (which are below)

image text in transcribed

And finally, here are the test cases that the code MUST pass!

inside happybirthday ['app'] True inside happybirthday ['pap'] False inside gggghhkkutdddflljjjjlkhhgdredh ['ggk','jjl'] True inside gggghhkkutdddflljjjjlkhhgdredh ['ggk','jjh'] False inside gggghhkkutdddflljjjjlkhhgdredh ['ggk','jjh','dfl'] True inside gggghhkkutdddflljjjjlkhhgdredh ['ggk','ddd'] True 
Command Prompt C:Users\swetha\Documents\CS-112\Assessment-5\Version-7>python driver5_v7 sample.py or input inside happybirthday ['app'], we expected True', but you got 'False assed test passed test For input inside geeghhkkutdddfl1jjjjlkhhgdredh ['egk', 'jjh'], we expected 'False' but you got 'True passed test passed test At least one test case did not pass yet % Total % Received %Xferd Average Speed Time Time 100 102 100 102 C:Users\ swetha\Documents\cS-112 Assessment-5\Version-7> Time Current Dload Upload Total Spent Left Speed 653 --:--: :--:...-:--:-- 6553

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

=+3. What is content curation and its role within social media?

Answered: 1 week ago

Question

=+4 What are non-union workers representations?

Answered: 1 week ago