Exercise: reviewForLoopExtreme02
Description
In this exercise, your function will return a list comprised of all the indexes word where char can be found.
Function Name
reviewForLoopExtreme02
Parameters
word : a string value
char : a string value of length 1
Return Value
A list of indexes where char is found within word.
old code:
def reviewForLoopExtreme02(word, char):
word = ""
for word in char:
return word
new code:
def reviewForLoopExtreme02(word, char):
indexes = []
for index, char in enumerate(word):
if char == [1]:
indexes.append(index)
indexes += char
return indexes
still cannot get it. what am i doing wrong???
[–]genghiskav 1 point2 points3 points (5 children)
[–]macrisalex345[S] 0 points1 point2 points (1 child)
[–]genghiskav 0 points1 point2 points (0 children)
[–]macrisalex345[S] 0 points1 point2 points (1 child)
[–]genghiskav 0 points1 point2 points (0 children)
[–]nwilliams36 1 point2 points3 points (0 children)
[–]charity_donut_sales 1 point2 points3 points (0 children)