Access over 20 million homework & study documents

search

Python

Content type
User Generated
Subject
Writing
School
Central Michigan University
Type
Homework
Rating
Showing Page:
1/1
def findSubstring(string, index):
cutIndex = 0
substring = ""
for i in range(0, len(string)):
if string[i] == index:
cutIndex = i
for i in range(0, cutIndex):
substring += string[i]
return substring
sub1 = findSubstring("44.4", ".")
sub2 = findSubstring("3.14", "4")
print(sub1)
print(sub2)

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
def findSubstring(string, index): cutIndex = 0 substring = "" for i in range(0, len(string)): if string[i] == index: cutIndex = i for i in range(0, cutIndex): substring += string[i] return substring sub1 = findSubstring("44.4", ".") sub2 = findSubstring("3.14", "4") print(sub1) print(sub2) Name: ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Great study resource, helped me a lot.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4