If I've understood the question correctly, I believe something like this is what you're after:
def smallest_digit(num):
smallest = num % 10
while num > 0:
reminder = num % 10
if smallest > reminder:
smallest = reminder
num = int(num / 10)
return smallest
small_num = ""
number_of_inputs = int(input("Number of inputs: "))
for i in range(number_of_inputs):
small_num += str(smallest_digit(int(input())))
First, the user is asked for the number of numbers they wish to input.
Then, the for loop will ask the user for an input number for the correct number of times that the user wanted.
This input is passed straight to the function smallest_digit (this is using your code from above to find the smallest digit in a given number).
The function returns the smallest digit, which is then added to a string called small_num.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…