I have a list of 8 organisms, they are assigned a number starting with zero. some of them are animals and some are not. this is the instructions for the activity, i’m unsure what coding to use.
We can “iterate” (AKA loop) over an enumerated list. An example can be found in the following code. Alter the code to only print()
one of the following statements for each organism.
organism
is an animal.
organism
is not an animal.
Hints:
- **Watch the [indentation]
- You will need to utilize an [if statement]
- To [access a specific item from a list]we can use what is called an index. In Python, all indexing starts at 0!
[148]:
Enumerating over the list of organisms and printing information/
for i, organism in enumerate(organisms):
print('Organism ', i) # print organism index
print(organism) # print organism