File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1+ #First and last occurrence of a string
12#26- Write a program that reads a sentence from the keyboard and shows how many times the letter "a" appears and in what position it is
23# appears the first time and in what position it appears last time.
34sentence = input ('Enter a sentence:' ).upper ()
45print (f'The letter A shows { sentence .count ('A' )} times.' )
56print (f'The first letter A shows in position { sentence .find ('A' )+ 1 } .' )
67print (f'The last letter A shows in position { sentence .rfind ('A' )+ 1 } .' )
8+
9+
10+ # Primeira e última ocorrência de uma string
11+ #26: Faça um programa que leia uma frase pelo teclado e mostre quantas vezes aparece a letra "A", em que posição ela aparece a
12+ # primeira vez e em que posição ela aparece a última vez.
13+ frase = str (input ('Digite uma frase:' )).upper ()
14+ print (f'A letra A, aparece { frase .count ('A' )} vezes na frase.' )
15+ print (f'A primeira letra "A" apareceu na { frase .find ('A' )+ 1 } posição da frase.' )
16+ print (f'A última letra "A" apareceu na { frase .rfind ('A' )+ 1 } posição da frase.' )
17+
18+ #PT- treinando a manipulação de strings.
19+ #EN- training string manipulation.
You can’t perform that action at this time.
0 commit comments