Another important task for many biologists is to merge/concatenate different strings of DNA in one unique sequence. We can modify the previous script to concatenate two distinct DNA sequences in one. We start using code_01 structure, adding some extra elements (line 3):
1 2 3 4
So far, we added a new string containing an extra
DNA sequence and we
Notice that in Python strings are immutable, meaning they cannot be changed. This immutability confers some advantages to the code where strings (in Python strings are not variables) cannot be modified anywhere in the program and also allowing some performance gain in the interpreter. So, in order to have our sequences merged we create a third sequence that receives both strings. Finally our code will be (some captions were added):
1 2 3 4 5 6 7 8
Easy, eh? Of course these two simple scripts do no scratch the surface of Python programming, but they are a start.