Solução do exercício guiado com while
This commit is contained in:
20
aula39.py
20
aula39.py
@@ -2,12 +2,18 @@
|
||||
Iterando strings com while
|
||||
"""
|
||||
# 012345678910
|
||||
nome = 'Luiz Otávio' # Iteráveis
|
||||
# nome = 'Luiz Otávio' # Iteráveis
|
||||
# 1110987654321
|
||||
tamanho_nome = len(nome)
|
||||
print(nome)
|
||||
print(tamanho_nome)
|
||||
print(nome[3])
|
||||
|
||||
nova_string = ''
|
||||
nova_string += '*L*u*i*z* *O*t*á*v*i*o'
|
||||
|
||||
nome = 'Maria Helena' # Iteráveis
|
||||
|
||||
indice = 0
|
||||
novo_nome = ''
|
||||
while indice < len(nome):
|
||||
letra = nome[indice]
|
||||
novo_nome += f'*{letra}'
|
||||
indice += 1
|
||||
|
||||
novo_nome += '*'
|
||||
print(novo_nome)
|
||||
|
||||
Reference in New Issue
Block a user