-2
I wanted to identify if the list item has the first uppercase letter.
I’ve tried For and While, but the result is always the same.
texto = input('Texto: ')
texto.split()
cont = 0
for c in texto:
if cont != 0:
a = c[0]
if a.isupper:
assunto = True
a = c
break
cont += 1
if assunto:
print(a)
else:
print('Sem assunto')
The answer to the code is always the second letter of the first word, and I don’t know why.
Example: If the phrase is "Do you like Sushi?" the program will return the letter "O", which is in the word "You". Strangely, it only returns the letters that are in this place.
What’s wrong with the code?
Thank you very much, my problem has been solved and it will be quite useful to me
– Luiz
I discovered the problem. isupper() returns True to spaces
– Luiz