- Joined
- May 1, 2015
- Messages
- 63
- Reaction score
- 7
- First Language
- english
- Primarily Uses
- RMMV
import random
loop = 0
loop2 = 0
def sequentialSearch(alist, item):
found = False
while loop2 < len(alist) and not found:
if alist[pos] == item:
found = True
else:
pos = pos+1
return found
while loop < 50:
randlist = (random.randint(0,100) for _ in range(100))
while loop2 < 10:
rannum = (random.randint(0,100) for _ in range(10))
print(sequentialSearch(randlist, rannum))
loop = 0
loop2 = 0
def sequentialSearch(alist, item):
found = False
while loop2 < len(alist) and not found:
if alist[pos] == item:
found = True
else:
pos = pos+1
return found
while loop < 50:
randlist = (random.randint(0,100) for _ in range(100))
while loop2 < 10:
rannum = (random.randint(0,100) for _ in range(10))
print(sequentialSearch(randlist, rannum))
the spoiler has the code i am trying to get working... the error i am getting is:
TypeError: object of type 'generator' has no len()

