Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

5 bytes added, 10:01, 3 June 2017
PART 2 - Manipulating Items in Lists
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: ' + str(number_index))
else: # If the statement is False, the else will run
print(str(number) + ' is not in list_of_numbers')
13,420
edits