Skip to content

Commit bd7ac18

Browse files
committed
doc: add comments
Exercises manipulating text.
1 parent 5f0bf19 commit bd7ac18

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

ex022.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,18 @@
99
print(f'Your name in total has {len(name)-name.count(' ')} letters.')
1010
separate = name.split()
1111
print(f'Your first name is {separate[0]} and he has {len(separate[0])} letters.')
12+
13+
# 022: Crie um programa que leia o nome completo de uma pessoa e mostre:
14+
# O nome com todas as letras maiúsculas e minúsculas.
15+
# Quantas letras ao todo (sem considerar espaços).
16+
# Quantas letras tem o primeiro nome.
17+
'''nome = str(input("Qual o seu nome completo?"))
18+
print(f"Seu nome com todas as letras em maiúsculo fica: {nome.upper()}")
19+
print(f"Seu nome em minúsculo fica: {nome.lower()}")
20+
print(f"Seu nome sem espaços tem {len(nome)-nome.count(' ')} letras.")
21+
separado = nome.split()
22+
print(f"Seu primeiro nome {separado[0]} tem {len(separado[0])} letras.")'''
23+
24+
25+
#PT- treinando a manipulação de strings.
26+
#EN- training string manipulation.

ex023.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,15 @@
99
print(f'Your ten is {ten}.')
1010
print(f'Your hundred is {hundred}.')
1111
print(f'Your thousand is {thousand}.')
12+
13+
14+
# 023: Faça um programa que leia um número de 0 a 9999 e mostre na tela cada um dos dígitos separados.
15+
'''numero = int(input('Digite um número qualquer:'))
16+
print(f'Analizando o numero {numero}....')
17+
print(f'Sua unidade é {numero // 1 % 10}, '
18+
f'sua dezena é {numero // 10 % 10},'
19+
f'sua centena é {numero // 100 % 10},'
20+
f'e seu milhar é {numero // 1000 % 10}')'''
21+
22+
#PT- treinando a manipulação de strings.
23+
#EN- training string manipulation.

ex024.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1-
#24- Create a program that reads the name of a city and says whether or not it starts with the name 'Saint'.
1+
#24- Create a program that reads the name of a city and says whether or not it starts with the name 'Saint'.
2+
from time import sleep
23
city = str(input('What city were you born?')).strip()
4+
print('Has a Saint in the name?)
5+
sleep(1)
36
print(city[:5].upper() == 'SAINT')
7+
8+
#024: Crie um programa que leia o nome de uma cidade diga se ela começa ou não com o nome "SANTO".
9+
'''cidade = str(input('Digite o nome de uma cidade:')).strip()
10+
print('Tem Santo no nome?')
11+
sleep(1)
12+
print(cidade[:5].upper() == 'SANTO')'''
13+
14+
15+
#PT- treinando a manipulação de strings.
16+
#EN- training string manipulation.

0 commit comments

Comments
 (0)