1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Romashka [77]
3 years ago
7

Write a generator function named count_seq that doesn't take any parameters and generates a sequence that starts like this: 2, 1

2, 1112, 3112, 132112, 1113122112, 311311222112, 13211321322112, ...To get a number in the sequence, enumerate how many there are of each digit (in a row) in the previous number. For example, the first number is "one 2", which gives us the second number "12". That number is "one 1" followed by "one 2", which gives us the third number "1112". That number is "three 1" followed by "one 2", or 3112. Etc.
Computers and Technology
1 answer:
-BARSIC- [3]3 years ago
6 0

Answer:

#required generator function

def count_seq():

   #starting with number 2. using string instead of integers for easy manipulation

   n='2'

   #looping indefinitely

   while True:

       #yielding the integer value of current n

       yield int(n)

       #initializing an empty string

       next_value=''

       #looping until n is an empty string

       while len(n)>0:

           #extracting first digit (as char)

           first=n[0]

           #consecutive count of this digit

           count=0

           #looping as long as n is non empty and first digit of n is same as first

           while len(n)>0 and n[0]==first:

               #incrementing count

               count+=1

               #removing first digit from n

               n=n[1:]

           #now appending count and first digit to next_value

           next_value+='{}{}'.format(count,first)

       #replacing n with next_value

       n=next_value

#testing, remove if you don't need this

if __name__ == '__main__':

   #creating a generator from count_seq()

   gen=count_seq()

   #looping for 10 times, printing next value

   for i in range(10):

       print(next(gen))

Explanation:

You might be interested in
What should be done if a system cannot boot from the hard drive?
White raven [17]
If the system cannot boot from the hard drive, then you should boot from the windows set-up dvd

I hope this helps! :)
3 0
2 years ago
Adrian wants to run a digital movie clip that his friend shared with him through email. His system has 2 GB of RAM and 20 GB of
bogdanovich [222]

Answer:

Adrian requires a high speed internet connection and a codec player to download and run movie on his system.

Explanation:

There are some basic requirements of the computers that, can be used to watch the movie on the computer.

1. RAM

2. Storage space to store the movie

3. High Speed Internet: As the movie is on the internet, to download it from internet, bandwidth and speed of internet is required.

4. Video Codec Player is required to play a digital movie on laptop or system.

3 0
2 years ago
Blender is used by which video game team member?
prohojiy [21]

Answer:

The 2nd one

Explanation:

6 0
3 years ago
The communication channel used in IMC must rev: 12_06_2018_QC_ CDR-223 Multiple Choice match the traditional channel used in tha
Setler [38]

Answer:

connect the sender with the desired recipients.

Explanation:

Integrated Marketing Communication (IMC) is a process through which organizations create seamless branding and coordination of their marketing and communication objectives with its business goals and target audience or consumers. The communication tools used in IMC are both digital and traditional media such as billboards, search engine optimization, magazines, television, blog, radio, webinars etc.

The communication channel used in IMC must connect the sender with the desired recipients.

The receiver is any individual who is able to read, hear or see and process the message being sent or communicated in the IMC communication process. Any interference the IMC communication process is known as noise.

An organization can analyze and measure the effectiveness of the IMC communication process by considering market share, sales, and customer loyalty.

5 0
2 years ago
You have several marketing documents that are published through AD RMS. However, you have three new marketing employees that req
snow_lady [41]

Answer:

Document unauthorized

Explanation:

this way new employees will not try to open

5 0
3 years ago
Other questions:
  • Search engines enable you to
    14·1 answer
  • Given two Generic variables, A with value "123" and B with value 456, what would the Write Line output of A + B be? 123456 579 A
    5·1 answer
  • Which two actions allow the System Administrator to limit Chatter access during roll-out to a subset of Salesforce users?
    9·1 answer
  • An Administrator wants to have a thank you email sent after the form on the "Request a Demo" landing page is submitted. Where ca
    12·1 answer
  • What is the term for a Web site that allows users to access and interact with software from any Internet-connected computer or d
    11·1 answer
  • Write an HTML document which contains two text fields, a button, and a div. The first text field should be labeled “Temperature”
    10·1 answer
  • A software package developed to handle information requirements for a specific type of business is called a(n) ____. A. outsourc
    10·1 answer
  • Here is a nested loop example that graphically depicts an integer's magnitude by using asterisks, creating what is commonly call
    7·1 answer
  • What does a hanging indent look like?
    7·1 answer
  • What is software engineering? What are the objectives of software engineering?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!