Advertisement
Txemin

Untitled

May 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. from random import randint
  2. sequence = [randint(0, 100) for i in range (20)]
  3. print(sequence)
  4.  
  5. number = int(input( "which number should I look for?"))
  6. position = 0
  7. found = False
  8. samler = []
  9. while position < len(sequence):
  10. if sequence[position] == number:
  11. samler.append(position)
  12. found = True
  13. position += 1
  14. else:
  15. position += 1
  16. if found == False:
  17. print("your number is not in the sequence")
  18. else:
  19. print("your number is in positión {}".format(samler))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement