Computer Science, asked by mayanazaharakhan, 1 month ago

+ A .il
MYSJAN21IMS-147
X
HandsOn Client - zahara.bee
Exam
Data
Submit Help
0:43:1
Question 1:
[8 Marks]
Write your solution in the PF_solution1.py file in the PF package
Problem Statement:
Description: Consider two lists containing numbers, say input_list1 and input_list2.
Write a Python program that accepts input_list1 and input_list2 as parameters and returns a list of numbers as output_list based on the logic below -
1
I
For each number in the input_list1 -
o
If the number is present in input_list2, add the number to output_list
For Example: if input_list1 = [26, 34] and input_list2 = [26, 21] then output_list = [26]
o
Otherwise, If the square of the number is present in input_list2, add the number to output_list
For Example: if input_list1 = [26, 17] and input_list2 = [289, 21] then output_list=[17]
O
Otherwise, if the last digit of the number in input_list1 is same as the last digit of the corresponding number in input_list2, add the number to output list
For Example: if input_list1 = [26, 41] and input_list2 = [289, 21] then output_list = [41]. The last digit of 41 in input_listi and the last digit of 21 in input_list are same and they are at same positions (position
1). Thus 41 is added to output_list
o
Otherwise, calculate the product of the all the digits of the number. If the product of digits is present in the input_list2, add the number to output_list
For Example: if input_list1 = [26, 37] and input_list2 = [21, 289] then output_list = [37]. The product of digits of the number 37 (3*7 = 21) in input_listi is present in input_list2. Thus 37 is added to output_list
Note:
1. The output_list should not contain duplicate elements
Assumptions:
1. The numbers of input_list1 will be of at least 2 dígits​

Answers

Answered by nidhikumari20021
0

Answer:

bro it is a question under stand

Similar questions