We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4e778c3 commit cc4b078Copy full SHA for cc4b078
lambda/example2.py
@@ -0,0 +1,25 @@
1
+# Add 10 to argument a, and return the result:
2
+x = lambda a : a + 10
3
+print(x(5))
4
+
5
+# square of number
6
+squ = lambda num: num**2
7
+print(squ(5))
8
9
+# Summarize argument a, b, and c and return the result:
10
+x = lambda a, b, c : a + b + c
11
+print(x(5, 6, 2))
12
13
14
+# reverse a string with the help of list, map, lamda
15
+fun=["pthon","is","fun"]
16
+ans=(list(map(lambda x:x[::-1],fun)))
17
+print(ans)
18
19
+# first latter of word of list
20
+name=["python","with","s3cloudehub"]
21
+(print(list(map(lambda n:n[0],name))))
22
23
+# print even number
24
+mynum=[1,2,3,4,5,6]
25
+print(list(filter(lambda num:num%2==0,mynum)))
0 commit comments