-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFMR7.py
More file actions
38 lines (21 loc) · 919 Bytes
/
FMR7.py
File metadata and controls
38 lines (21 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from functools import reduce
CheckEven = lambda No: (No % 2 == 0) # using Lambda Function
Doubles = lambda No: No*2 # using Lambda Function
Sum = lambda A,B: A+B # using Lambda Function
def main():
print("Enter number of elements you want to enter: ")
iSize = int(input())
Data_Input = []
print("Please enter the data")
for iCnt in range(0,iSize,1):
Value = int(input())
Data_Input.append(Value)
print("Data is: ",Data_Input)
Data_Filter = list(filter(CheckEven, Data_Input))
print("Data After Filter is: ",Data_Filter)
Data_Map = list(map(Doubles, Data_Filter))
print("Data after map is: ",Data_Map)
Output = reduce(Sum,Data_Map)
print("Result After Reduce is: ",Output)
if __name__ == "__main__":
main()