Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given a list containing tuples. Each tuple has 2 digits, each between 0 and 9. For example, here is a list with two

You are given a list containing tuples. Each tuple has 2 digits, each between 0 and 9.

For example, here is a list with two tuples. [(1,2), (5,1)]. You are to use the tuples to construct a sequence of numbers. The meaning of each tuple s as follows: (the digit to be used, how many times).

In the example above you have two tuples, so you need to construct a generator to produce the next number, in increasing numerical order, where each number you generate has exactly two ones (1,2) and one five (5,1). You can use as many zeros as needed to generate the next number. So, for this example, the first few numbers generated would be 115, 151, 511, 1015, 1051,

Question:

Write a generator

def nextOne(s):

Where s is the list of tuples

For the purpose of this problem, you may assume that each input list has only two tuples.

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 Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions