-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFMR8.py
More file actions
31 lines (18 loc) · 774 Bytes
/
FMR8.py
File metadata and controls
31 lines (18 loc) · 774 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
from functools import reduce
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( lambda No: (No % 2 == 0), Data_Input))
print("Data After Filter is: ",Data_Filter)
Data_Map = list(map(lambda No: No*2 , Data_Filter))
print("Data after map is: ",Data_Map)
Output = reduce(lambda A,B: A+B ,Data_Map)
print("Result After Reduce is: ",Output)
if __name__ == "__main__":
main()