-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex078.py
More file actions
30 lines (22 loc) · 692 Bytes
/
ex078.py
File metadata and controls
30 lines (22 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Faça um programa que leia 5 valores
# e os guarde em uma lista.
# No final, mostre qual o maior e o menor
# valores digitados e suas respectivas
# posições
print('Digite 5 números inteiros:')
try:
lista = [ ]
for i in range(5):
lista.append( input('>>>\t'))
maiorValor = max(lista)
print(f'\nO maior valor foi { maiorValor } nas posições: ', end='')
for i, item in enumerate(lista):
if item == maiorValor:
print(f'{i+1}ª', end=' ')
menorValor = min(lista)
print(f'\nO maior valor foi { menorValor } nas posições: ', end='')
for i, item in enumerate(lista):
if item == menorValor:
print(f'{i+1}ª', end=' ')
except Exception as e:
print(f'Erro... {e}')