Why does it end with "none"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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")

7th Feb 2020, 10:36 PM
MyNameIsMutable
MyNameIsMutable - avatar
7 Answers
+ 1
def capital_indexes(z): lst = [] for c, j in enumerate(z): if j.isupper(): lst.append(c) return lst print(capital_indexes("GRRRRR"))
7th Feb 2020, 10:59 PM
Bahhaāµ£
Bahhaāµ£ - avatar
+ 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?
7th Feb 2020, 10:47 PM
Bahhaāµ£
Bahhaāµ£ - avatar
+ 2
oh okay so I create an empty list and then append the indexes to it thank you plenty @bahha
7th Feb 2020, 11:14 PM
MyNameIsMutable
MyNameIsMutable - avatar
+ 1
Ohhhh its asking for a list x.x
7th Feb 2020, 10:53 PM
MyNameIsMutable
MyNameIsMutable - avatar
+ 1
the code you wrote above does not return anything it just prints the indexes.
7th Feb 2020, 10:55 PM
Bahhaāµ£
Bahhaāµ£ - avatar
+ 1
Yes MyNameIsMutable it will count each capital letter in the index https://code.sololearn.com/cAVG4Vex9zTY/?ref=app
7th Feb 2020, 11:18 PM
BroFar
BroFar - avatar
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].
7th Feb 2020, 10:53 PM
MyNameIsMutable
MyNameIsMutable - avatar