60 384
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #3388 in Python for mukunda

Question #3388
& Text = “Python is a multi-paradigm programming language. Rather than forcing programmers to adopt a particular style of programming, it permits several styles: object-oriented programming and structured programming are fully supported, and there are a number of language features which support functional programming and aspect-oriented programming (including by meta programming and by magic methods). <br>Many other paradigms are supported using extensions, such as pyDBC and Contracts for Python which allow Design by Contract”
Search = “pro”
Write a python program to find all occurrences of string ‘Search’ in a given string ‘Text
Expert's answer
import re

text = """
Python is a multi-paradigm programming language. Rather than forcing programmers to adopt a particular style of programming, it permits several styles: object-oriented programming and structured programming are fully supported, and there are a number of language features which support functional programming and aspect-oriented programming (including by meta programming and by magic methods
Many other paradigms are supported using extensions, such as pyDBC and Contracts for Python which allow Design by Contract
"""

search = "pro"

for m in re.finditer (search, text):
print(search, "is at position", m.start())

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions