Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use python to solve this Now, instead of indexing a list, you can write a function that finds at which index/indices a character is

please use python to solve this image text in transcribed
Now, instead of indexing a list, you can write a function that finds at which index/indices a character is found within a string Write a function that uses a for loop and the range function to return a list of all indices at which a char occurred in the text. For example, if the input text is Mississippi and charis , the function should return 12, 3, 5, 6); if the char is the function should return [0]; if the charis 1, you should get 11, 4, 7, 101. def get index_list(text, char): Given text and a single character char, which are both strings, return a list that contains the indices at which char occurred in the text. If text or char is not a string, or if a char is longer than 1 character, return None. If char is not found, return an empty list return "stub

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

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

Understand why customers are loyal to a particular service firm.

Answered: 1 week ago