Computer Science, asked by dikshaupadhyay202000, 3 months ago

you are provided with 3 numbers input 1 input 2 input 3 each of these are four digit numbers within range
 >  = 1000
and
 <  = 9999
i.e
1000 <  = input1  <  =  9999
1000 <  = input2 <  = 9999
1000 <  = input3 <  = 9999
you are expected to find the key using below formula

key= smallest digit in thousands place of all three numbers
smallest digit in the hundred place of ,all three numbers
smallest digit in the tens place of all three numbers
smallest digit in the units place of all three numbers

assuming that 3 numbers are passed to given function,complete the function to find and return key

Answers

Answered by jai696
1

\huge\red{\mid{\fbox{\tt{Using\: Python\: 3}}\mid}}

def key_gen(n1, n2, n3):

digits_list = [list(map(int, str(n1))), list(map(int, str(n2))),

list(map(int, str(n3)))]

min_thousands = str(min([digits[0] for digits in digits_list]))

min_hundreds = str(min([digits[1] for digits in digits_list]))

min_tens = str(min([digits[2] for digits in digits_list]))

min_units = str(min([digits[3] for digits in digits_list]))

return int(min_thousands + min_hundreds + min_tens + min_units)

print("Key:", key_gen(9614, 3920, 5588))

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by Japji21
0

Answer:

def key_gen(n1, n2, n3):

digits_list = [list(map(int, str(n1))), list(map(int, str(n2))),

list(map(int, str(n3)))]

min_thousands = str(min([digits[0] for digits in digits_list]))

min_hundreds = str(min([digits[1] for digits in digits_list]))

min_tens = str(min([digits[2] for digits in digits_list]))

min_units = str(min([digits[3] for digits in digits_list]))

return int(min_thousands + min_hundreds + min_tens + min_units)

print("Key:", key_gen(9614, 3920, 5588))

Similar questions