Look and Say
Objectives
- Practice, practice, practice!
In this exercise, you will implement the look-and-say sequence. The sequence starts as follows:
1, 11, 21, 1211, 111221, 312211, 13112221, …
The sequence is constructed starting with 1 and reading out quantities of digits left-to-right to determine the subsequent numbers.
Problem 1 Write the next function. next takes one argument (term, an integer) and returns the number generated by applying the rules of the look-and-say sequence.
Here is some example output:
Note
Your next function should return an integer!
Problem 2 Write the readit function. readit takes one argument (seq_length, an integer) and prints out the first seq_length items in the Look-and-Say sequence.