File tree 2 files changed +42
-0
lines changed
2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
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 )))
Original file line number Diff line number Diff line change
1
+ # Local Reassigment!
2
+ x = 200
3
+ print (f"just localy change x to { x } " )
4
+
5
+ # How To Run
6
+ # local_ocal_example.py"
7
+ # output just localy change x to 200
8
+
9
+ def myfunc ():
10
+ x = 300 #local veriabal
11
+ print (x )
12
+
13
+ myfunc ()
14
+
15
+ # How To Run
16
+ # local_ocal_example.py"
17
+ # output 300
You can’t perform that action at this time.
0 commit comments