You are provided with 3 numbers : input1, input2 and input3.
Each of these are four digit numbers within the range >=1000 and <=9999
j.e.
1000 <= input1 <= 9999
1000 <= input2 <= 9999
1000 <= input3 <= 9999
You are expected to find the Key using the below formula -
Key = [largest digit in the thousands place of all three numbers] [largest digit in
the hundreds place of all three numbers] [largest digit in the tens place of all
three numbers] [largest digit in the units place of all three numbers]
For e..g. if input1 = 3521. input2=2452. input3=1352, then Key = [3] [5] [5] [2] =
3552
Answers
Answered by
42
The following cσdes have been written using Python.
input1 = input("Enter a 4-digit number: ")
input2 = input("Enter a 4-digit number: ")
input3 = input("Enter a 4-digit number: ")
print()
ul = list()
tl = list()
hl = list()
thl = list()
ul.append(input1[-1])
tl.append(input1[-2])
hl.append(input1[-3])
thl.append(input1[-4])
ul.append(input2[-1])
tl.append(input2[-2])
hl.append(input2[-3])
thl.append(input2[-4])
ul.append(input3[-1])
tl.append(input3[-2])
hl.append(input3[-3])
thl.append(input3[-4])
um = max(ul)
tm = max(tl)
hm = max(hl)
thm = max(thl)
print(thm + hm + tm + um)
Answered by
0
Explanation:
input 1=3521
input 2=2452
input 3=1352
key =[3] [5] [5] [2]=3552
Similar questions
English,
3 months ago
Math,
3 months ago
Science,
7 months ago
Social Sciences,
7 months ago
Math,
11 months ago
Environmental Sciences,
11 months ago
Physics,
11 months ago