# Look-and-Say Sequence

In this lesson, you will learn how to generate the next term of the Look-and-Say sequence in Python.

## We'll cover the following

In this lesson, we will be considering the so-called “Look-and-Say” sequence. The first few terms of the sequence are:

```
1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ...
```

To generate a member of the sequence from the previous member, read off the digits of the previous member and record the count of the number of digits in groups of the same digit.

For example, `1`

is read off as one `1`

which implies that the count of `1`

is one. As `1`

is read off as “one 1”, the next sequence will be written as `11`

where `1`

replaces `one`

. Now `11`

is read off as “two 1s” as the count of “1” is two in this term. Hence, the next term in the sequence becomes `21`

.

Have a look at the slides below where we generate this sequence up to the fifth term.

Get hands-on with 1200+ tech skills courses.