Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. vetor = []
  2.  
  3. for i in range(1, 5):
  4. vnum = int(input('Digite um valor: '))
  5. vetor.append(vnum)
  6. num = int(input("Digite o valor a ser pesquisado: "))
  7.  
  8. i = 0
  9. achei = False
  10.  
  11. while i <= 4 and achei == False:
  12. if num == vetor[i]:
  13. achei = True
  14. else:
  15. i = i + 1
  16. if achei == True:
  17. print(f'O numero {num} esta na posição {vetor[i]}')
  18. else:
  19. print(f'O numero {num} não se encontra na lista.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement