Question

Write A python program to return all matches for a given search keyword to return the...

Write A python program to return all matches for a given search keyword to return the matched indexes. Hint use string.find(search, begin, end) recursively or in interation

Homework Answers

Answer #1

PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU NEED ANY MODIFICATION THEN LET ME KNOW, I WILL DO IT FOR YOU

def findMatch(sentence,text):
    i=0
    while(i<len(sentence)):
        n = sentence.find(text,i,len(sentence))
        if(n!=-1):
            return n
        i+=1
    return -1

print(findMatch("My name is nikhil","nikhil"))
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Python: Write a program that performs a logarithmic search on an ordered list of 1000 elements....
Python: Write a program that performs a logarithmic search on an ordered list of 1000 elements. The search on the list should be on a randomly generated number between 1-1000.
Python: Write a program that performs a sequential search on an ordered list of 1000 elements....
Python: Write a program that performs a sequential search on an ordered list of 1000 elements. The search on the list should be on a randomly generated number between 1-1000.
Write a python program to list all files in the given directory along with their length...
Write a python program to list all files in the given directory along with their length and last modification time. The output should contain one line for each file containing filename, length and modification date separated by tabs. https://www.tutorialspoint.com/python/python_modules.htm
Write a Python program to manage league matches. Different teams can participate in a league. A...
Write a Python program to manage league matches. Different teams can participate in a league. A player belongs to a team and a team can play many games in a league. For each team the league wants to track the name of the team and the number of players in each team. The league also wants to track the number of games the team has played, and the total numbers of points scored across all games played. During each game...
Use python write a function that takes the scores of all players as keyword arguments and...
Use python write a function that takes the scores of all players as keyword arguments and returns the name of the player with maximum score after calculating the scores with the truncated mean scoring(remove one highest score and one lowest score). Do not import anything eg. def bp(**player_scores):     >>> bp(ab=[9.6, 9, 9.8, 9.9], bc=[9.0, 9.5, 9.9],cd=[10.0, 9.8, 10.0, 9.5, 9.6])     'cd'     >>> bp(ab=[3.8, 3.5, 3.2], bc=[4.0, 3.6, 3.0])     'bc'   
Submission Question: Recursion with Trees – Depth First Search & Breadth First Search Write a Python...
Submission Question: Recursion with Trees – Depth First Search & Breadth First Search Write a Python program using the Python IDE based on recursion with trees that is both depth first and breadth first searches. The Python program to be developed will demonstrate the use of both depth-first (DFS) and breadth-first (BFS) searches. A tree node structure will be developed that will be used both for DFS and BFS searches. The program will apply recursion both for the DFS and...
use python Write a program that uses a for loop to display all prime numbers within...
use python Write a program that uses a for loop to display all prime numbers within the range [500, 800] (hint: prime numbers are numbers that have only 2 factors: 1 and themselves. You can use a loop function to check if a number has a factor other than 1 or itself using % operation)
Given an array containing 1500 integers, write a C++ program that searches through the array for...
Given an array containing 1500 integers, write a C++ program that searches through the array for a user given value. (Hint: Use Sequential and Binary Search algorithms).
Write a python program that reads a word list and prints out all the anagrams in...
Write a python program that reads a word list and prints out all the anagrams in the word list. In earlier exercises you saw how to read a word list. Also, in earlier examples we saw how the sorted characters of a word are a useful canonical representation of an anagram (Hint: Therefore, useful as a key).
IN PYTHON : Write a program that asks the user for a number. Write the number...
IN PYTHON : Write a program that asks the user for a number. Write the number to a file called total.txt. Then ask the user for a second number. Write the new number on line 2 with the total for both numbers next to it separated by a comma. Then ask the user for a third number and do the same. Keep asking for numbers until the person puts in a zero to terminate the program. Close the file. Be...