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( "\n Which number between 0 - 100 should I look for? "))
- samler = []
- found = False
- for position in range(len(sequence)):
- loop = True
- while loop:
- if sequence[position] == number:
- print(number, "is at position", str(position))
- samler.append(position)
- found = True
- loop = False
- else:
- loop = False
- if found == True:
- print("\n Your number(s) is/are in position(s) {}\n ".format(samler))
- else:
- print( "\n Your number is not in the set \n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement