-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the code, a note about function and replaced objetive
- Loading branch information
1 parent
dbbd2ab
commit c0ed6a4
Showing
1 changed file
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
# Procurando uma substring em uma string. | ||
# Exercícios com strings e procurando uma substring em uma string. | ||
|
||
frase = 'Olá, mundo!' | ||
print(frase) | ||
print(f'Tipo da string: {type(frase)}') | ||
print(f'Tamanho: {len(frase)}') | ||
print('Concatenação:', 'Meu Brasil ' + 'brasileiro') | ||
frase_alterada = frase.replace('mundo', 'meu abacate') | ||
|
||
print(frase_alterada) | ||
print(frase.startswith('Olá')) | ||
print(frase.endswith('mundo')) | ||
print(frase_alterada.count('abacate')) | ||
|
||
# procurando uma substring em uma string | ||
string = 'Universidade do Estado de Santa Catarina' | ||
substring = 'Estado' | ||
print(substring in string) | ||
|
||
if substring in string: | ||
print('Encontrou') |