Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3 Your task is to create a function that will take an integer and return the result of the look-and-say function on that integer.

Python 3

Your task is to create a function that will take an integer and return the result of the look-and-say function on that integer. This should be a general function that takes as input any positive integer, and returns an integer; inputs are not limited to the sequence which starts with "1".

Conway's Look-and-say sequence goes like this:

Start with a number.

Look at the number, and group consecutive digits together.

For each digit group, say the number of digits, then the digit itself.

Sample inputs and outputs:

1 is read as "one 1" => 11 11 is read as "two 1s" => 21 21 is read as "one 2, then one 1" => 1211 9000 is read as "one 9, then 3 0s" => 1930 222222222222 is read as "twelve 2s" => 122

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

Students also viewed these Databases questions