> For the complete documentation index, see [llms.txt](https://igb.mit.edu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://igb.mit.edu/mini-courses/python/introduction-to-python-for-biologists/control-flows-and-loops.md).

# Control Flows and Loops

* Example 1: deciding palindrome sequences from many candidates

```
In [1]: manyseqs=['ACTGATG','ACTGGTCA','ATGATG','TCGAAGCT','GCAGGCG','GATCCTAG','CATGTCGT','CTCTATCTC']
In [2]: for seq in manyseqs:
   ...:     if (seq==seq[::-1]):
   ...:         print(seq)
   ...:         
ACTGGTCA
TCGAAGCT
GATCCTAG
CTCTATCTC
```

* Example 2: print odd numbers 1 to 20

```
In [1]: for i in range(1,21):
   ...:     if (i%2==1) :
   ...:         print("%02d" %i)
   ...:         
01
03
05
07
09
11
13
15
17
19
```
