Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List capital letters
#1
Hello again! Smile

I'm trying to return a list of all the indexes in the string that have capital letters.

lista =[]
def capital_letters(arg):
   for i in arg:
       if i.isupper():
                            #place the capital letters in the list
           return lista

print(capital_letters('tZtTtT'))
I tried:

lista.append(i)
but it return only the first capital letter in the string.
Reply


Messages In This Thread
List capital letters - by ricardodepaula - Jul-21-2019, 05:09 PM
RE: List capital letters - by Yoriz - Jul-21-2019, 05:27 PM
RE: List capital letters - by DeaD_EyE - Jul-21-2019, 05:42 PM
RE: List capital letters - by ndc85430 - Jul-21-2019, 05:43 PM
RE: List capital letters - by DeaD_EyE - Jul-21-2019, 06:53 PM
RE: List capital letters - by ricardodepaula - Jul-21-2019, 11:35 PM
RE: List capital letters - by ndc85430 - Jul-22-2019, 05:37 AM
RE: List capital letters - by DeaD_EyE - Jul-22-2019, 06:45 AM
RE: List capital letters - by ricardodepaula - Jul-23-2019, 03:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  item from a line to list however when i print the line instead of words i get letters Sutsro 5 3,033 Apr-22-2020, 02:39 PM
Last Post: deanhystad
  Pynput - no capital letters jmair 2 4,599 Feb-12-2019, 09:53 PM
Last Post: jmair
  make a list of string in capital by using a function anancba 3 3,482 Nov-23-2017, 06:42 AM
Last Post: heiner55
  Ending loop with string (capital & lowercase) MattWilk97 3 3,487 Oct-22-2017, 09:13 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020