From 7b48465a80068aaab91073c3b7f4f9a77dff50fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Ot=C3=A1vio?= Date: Fri, 28 Oct 2022 06:08:24 -0300 Subject: [PATCH] =?UTF-8?q?Solu=C3=A7=C3=A3o=20do=20exerc=C3=ADcio=20guiad?= =?UTF-8?q?o=20com=20while?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aula39.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/aula39.py b/aula39.py index 18ef034..b0efb76 100644 --- a/aula39.py +++ b/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)