DEV Community

Cover image for Python challenges 1

Python challenges 1

Mahmoud EL-kariouny on August 09, 2021

level of challenge = 2/10 Capital indexes Write a function named capital_indexes. The function takes a single parameter, wh...
Collapse
 
oritrix profile image
Oritrix

Why is this not a solution?

def capital_indexes(word):
list = []
p = 0
for i in str(word):
if i.isupper():
list.append(p)
p = p + 1

print(list)
Enter fullscreen mode Exit fullscreen mode

capital_indexes("HeLlO")

This does everything it should? but i'm confused?

Collapse
 
aheisleycook profile image
privatecloudev

You can import string
String.ascii_uppercae