Python: Editing sequences
To edit sequences we can simply add them together, for example:
[0, 1, 2]+[3, 4, 5, 6]
In this case it would output 0, 1, 2, 3, 4, 5, 6 as we are simply joining the two sequences.
So what if we joined a sequence, with a sequence of strings?
Well it wouldn't quite work, this is because Python doesn't like joining two different data types.
We can also times strings together, but it doesn't quite react the way you might have thought:
'Hello'*3
Would output "HelloHelloHello', this is simply "Hello" three times.
We can also multiply sequences to get a similar result:
[1, 2]*3
The above would output [1, 2, 1, 2, 1, 2].
We can also check if elements are in sequences/strings by using "in".
For example if we wanted to know if 6 was in our sequence, we would do something like this:
Sequence = [0, 1, 2, 3, 4, 5, 6] 6 in Sequence
This would output "True" as 6 is in the sequence.
If the Sequence does not contain the value then it outputs false:
99 in Sequence
The above would output "False".
Back to Python

