13,420
edits
Changes
→PART 2 - Manipulating Items in Lists
:#Issue the following:<source>
list_of_numbers = [ 1, 5, 2, 6, 8, 5, 10, 2 ]
number = 107
if number in list_of_numbers: # Returns True if value in list, returns False if item not in list
number_index = list_of_numbers.index(number)
print('index is: ' + number_index)
else: # If the statement is False, the else will run
print(str(number) + ' is not in list_of_numbers')
</source>