Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- sequence = [randint(0, 100) for i in range (20)]
- print(sequence)
- number = int(input( "which number should I look for?"))
- position = 0
- found = False
- samler = []
- while position < len(sequence):
- if sequence[position] == number:
- samler.append(position)
- found = True
- position += 1
- else:
- position += 1
- if found == False:
- print("your number is not in the sequence")
- else:
- print("your number is in positión {}".format(samler))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement