In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of December 14th
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #09 exercise sheet]


In this problem you should submit a function as described. Inside the function do not print anything that was not asked!

(in this class you are expected to write a solution that uses recursion - mooshak will not force it, but that should be your goal)

[IP090] Eccentric Numbers

Professor Farnsworth, the eccentric genius, is conducting an experiment involving sequences of numbers. He needs a list of all k digit ineteger where a specific digit d appears exactly n times. The other digits can be any valid digit (0-9) but must not violate the total length k and must not have leading zeros.

Being busy with inventing doomsday devices, the Professor has tasked you with writing a program to generate this list for him.

The Problem

Write a function numbers(k, n, d) returns a list of all integer numbers with k digits such that digit d appears exactly n times.

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

2 ≤ k ≤ 8       number of digits
0 ≤ n ≤ k       number of times digit d appears
0 ≤ d ≤ 9       digit to appear n times

Example Function Calls Example Output
output = numbers(2,1,3)
print(sorted(output))

print()

output = numbers(3,2,5)
print("output is of type", type(output))
print("output has size:", len(output))
for x in sorted(output): print(x)
[13, 23, 30, 31, 32, 34, 35, 36, 37, 38, 39, 43, 53, 63, 73, 83, 93]

output is of type <class 'list'>
output has size: 26
155
255
355
455
505
515
525
535
545
550
551
552
553
554
556
557
558
559
565
575
585
595
655
755
855
955

Introduction to Programming (CC1024)
DCC/FCUP - University of Porto