Skip to content

Commit 5e4d994

Browse files
committed
up
1 parent da6b7bc commit 5e4d994

File tree

8 files changed

+62
-0
lines changed

8 files changed

+62
-0
lines changed

ex062.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#EN- Loop structure: While
2+
#Super Arithmetic Progression v3.0
13
#62- Improve challenge 61 by asking the user if he wants to show some more terms. The program will exit when he says he
24
# wants to show 0 terms.
35
print("Arithmetic progression generator")
@@ -16,3 +18,9 @@
1618
counter += 1
1719
print("Pause")
1820
more = int(input("How many more terms do you want to show?"))
21+
22+
23+
#PT- Estrutura de repetição: While
24+
#Super Progressão Aritmética v3.0
25+
#62: Melhore o DESAFIO 61, perguntando para o usuário se ele quer mostrar mais alguns termos. O programa encerrará
26+
# quando ele disser que quer mostrar 0 termos.

ex063.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#EN- Loop structure: While
12
#63-Write a program that reads any integer number N and displays on the screen the first N elements of a
23
# Fibonacci Sequence.
34
terms = int(input("How many terms do you want to show?"))

ex064.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#EN- Loop structure: While
12
#64-Create a program that reads several integers from the keyboard. The program will only stop when the user enters the
23
# value 999, which is the stopping condition. At the end, show how many numbers were entered and what the sum of them
34
# was (disregarding the flag).

ex065.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#EN- Loop structure: While
12
# 65- Create a program that reads several integers from the keyboard. At the end of the execution, show the average of
23
# all the values and which were the highest and lowest values read. The program should ask the user whether or not he
34
# wants to continue entering values.

ex079.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#Valores únicos em uma Lista
2+
#079: Crie um programa onde o usuário possa digitar vários valores numéricos e cadastre-os em uma lista. Caso o número
3+
# já exista lá dentro, ele não será adicionado. No final, serão exibidos todos os valores únicos digitados, em ordem
4+
# crescente.
5+
numero = list()
6+
while True:
7+
n = int(input('Digite um valor:'))
8+
if n not in numero:
9+
numero.append(n)
10+
print('Valor adicionado com sucesso.')
11+
else:
12+
print('Valor duplicado. Não vou adicionar.')
13+
r = str(input('Quer continuar?[S/N]'))
14+
if r in "Nn":
15+
break
16+
numero.sort()
17+
print(f'Você digitou os valores {numero}.')

ex080.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#Lista ordenada sem repetições
2+
#080: Crie um programa onde o usuário possa digitar cinco valores numéricos e cadastre-os em uma lista, já na posição correta de
3+
# inserção (sem usar o sort()). No final, mostre a lista ordenada na tela.
4+
lista = []
5+
for c in range (0,5):
6+
n = int(input('Digiter um valor:'))
7+
if c == 0 or n > lista[-1] :
8+
lista.append(n)
9+
else:
10+
pos = 0
11+
while pos < len(lista):
12+
if n <= lista[pos]:
13+
lista.insert(pos, n)
14+
break
15+
pos += 1
16+
print(f'Os valores digitados em ordem foram {lista}.')

ex081.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#Extraindo dados de uma Lista
2+
#081: Crie um programa que vai ler vários números e colocar em uma lista.Depois disso, mostre:
3+
# A) Quantos números foram digitados.
4+
# B) A lista de valores, ordenada de forma decrescente.
5+
# C) Se o valor 5 foi digitado e está ou não na lista.
6+
valores = []
7+
while True:
8+
valores.append(int(input('Digite um valor:')))
9+
resp = str(input('Quer continuar? [s/n]'))
10+
if resp in "Nn":
11+
break
12+
print(f'Você digitou {len(valores)} elementos.')
13+
valores.sort(reverse=True)
14+
print(f'Os valores em ordem decrescente são {valores}.')
15+
if 5 in valores:
16+
print('O valor 5 faz parte da lista.')
17+
else:
18+
print('O valor 5 não está na lista.')

ex082.py

Whitespace-only changes.

0 commit comments

Comments
 (0)