0
Why does it end with "none"?
I am doing a challenge on another site yet after finishing this code and submitting it says that "none" prints out at the end. When I test the code it does not say "none" though. Thank you for the help in advanced. def capital_indexes(z): for c, j in enumerate(z): if j.isupper(): print(c) capital_indexes("GRRRRR")
7 odpowiedzi
+ 1
def capital_indexes(z):
lst = []
for c, j in enumerate(z):
if j.isupper():
lst.append(c)
return lst
print(capital_indexes("GRRRRR"))
+ 3
what website? or could you provide more information about the challenge's output.
the code is for printing the index of Capital letters but in what format?
+ 2
oh okay so I create an empty list and then append the indexes to it thank you plenty @bahha
+ 1
Ohhhh its asking for a list x.x
+ 1
the code you wrote above does not return anything it just prints the indexes.
+ 1
Yes MyNameIsMutable it will count each capital letter in the index
https://code.sololearn.com/cAVG4Vex9zTY/?ref=app
0
Its pythonprinciples.com
Challenge
Capital indexes
Write a function named capital_indexes. The function takes a single parameter, which is a string. Your function should return a list of all the indexes in the string that have capital letters.
For example, calling capital_indexes("HeLlO") should return the list [0, 2, 4].