File tree Expand file tree Collapse file tree 2 files changed +384
-0
lines changed
Expand file tree Collapse file tree 2 files changed +384
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "cells" : [
3+ {
4+ "cell_type" : " code" ,
5+ "execution_count" : 1 ,
6+ "metadata" : {},
7+ "outputs" : [],
8+ "source" : [
9+ " # normal style"
10+ ]
11+ },
12+ {
13+ "cell_type" : " code" ,
14+ "execution_count" : 2 ,
15+ "metadata" : {},
16+ "outputs" : [],
17+ "source" : [
18+ " def fonk1(x):\n " ,
19+ " return x * 2"
20+ ]
21+ },
22+ {
23+ "cell_type" : " code" ,
24+ "execution_count" : 3 ,
25+ "metadata" : {},
26+ "outputs" : [],
27+ "source" : [
28+ " x = fonk1(4)"
29+ ]
30+ },
31+ {
32+ "cell_type" : " code" ,
33+ "execution_count" : 4 ,
34+ "metadata" : {},
35+ "outputs" : [
36+ {
37+ "data" : {
38+ "text/plain" : [
39+ " 8"
40+ ]
41+ },
42+ "execution_count" : 4 ,
43+ "metadata" : {},
44+ "output_type" : " execute_result"
45+ }
46+ ],
47+ "source" : [
48+ " x"
49+ ]
50+ },
51+ {
52+ "cell_type" : " code" ,
53+ "execution_count" : 5 ,
54+ "metadata" : {},
55+ "outputs" : [],
56+ "source" : [
57+ " # Lambda style"
58+ ]
59+ },
60+ {
61+ "cell_type" : " code" ,
62+ "execution_count" : 6 ,
63+ "metadata" : {},
64+ "outputs" : [],
65+ "source" : [
66+ " fonk2 = lambda x : x * 2"
67+ ]
68+ },
69+ {
70+ "cell_type" : " code" ,
71+ "execution_count" : 7 ,
72+ "metadata" : {},
73+ "outputs" : [
74+ {
75+ "name" : " stdout" ,
76+ "output_type" : " stream" ,
77+ "text" : [
78+ " 8\n "
79+ ]
80+ }
81+ ],
82+ "source" : [
83+ " print(fonk2(4))"
84+ ]
85+ },
86+ {
87+ "cell_type" : " code" ,
88+ "execution_count" : 10 ,
89+ "metadata" : {},
90+ "outputs" : [],
91+ "source" : [
92+ " isEven = lambda n : n % 2 == 0"
93+ ]
94+ },
95+ {
96+ "cell_type" : " code" ,
97+ "execution_count" : 11 ,
98+ "metadata" : {},
99+ "outputs" : [
100+ {
101+ "name" : " stdout" ,
102+ "output_type" : " stream" ,
103+ "text" : [
104+ " False\n "
105+ ]
106+ }
107+ ],
108+ "source" : [
109+ " print(isEven(3))"
110+ ]
111+ },
112+ {
113+ "cell_type" : " code" ,
114+ "execution_count" : 12 ,
115+ "metadata" : {},
116+ "outputs" : [
117+ {
118+ "name" : " stdout" ,
119+ "output_type" : " stream" ,
120+ "text" : [
121+ " even number\n "
122+ ]
123+ }
124+ ],
125+ "source" : [
126+ " if(isEven(6)):\n " ,
127+ " print(\" even number\" )"
128+ ]
129+ },
130+ {
131+ "cell_type" : " markdown" ,
132+ "metadata" : {},
133+ "source" : [
134+ " **Note**: In general,Lambda function uses to write little function instead of (def function....)"
135+ ]
136+ },
137+ {
138+ "cell_type" : " code" ,
139+ "execution_count" : 15 ,
140+ "metadata" : {},
141+ "outputs" : [],
142+ "source" : [
143+ " reverseString = lambda s : s[::-1]"
144+ ]
145+ },
146+ {
147+ "cell_type" : " code" ,
148+ "execution_count" : 16 ,
149+ "metadata" : {},
150+ "outputs" : [
151+ {
152+ "name" : " stdout" ,
153+ "output_type" : " stream" ,
154+ "text" : [
155+ " egaugnaL gnimmargorP nohtyP\n "
156+ ]
157+ }
158+ ],
159+ "source" : [
160+ " print(reverseString(\" Python Programming Language\" ))"
161+ ]
162+ },
163+ {
164+ "cell_type" : " code" ,
165+ "execution_count" : null ,
166+ "metadata" : {},
167+ "outputs" : [],
168+ "source" : []
169+ }
170+ ],
171+ "metadata" : {
172+ "kernelspec" : {
173+ "display_name" : " Python 3" ,
174+ "language" : " python" ,
175+ "name" : " python3"
176+ },
177+ "language_info" : {
178+ "codemirror_mode" : {
179+ "name" : " ipython" ,
180+ "version" : 3
181+ },
182+ "file_extension" : " .py" ,
183+ "mimetype" : " text/x-python" ,
184+ "name" : " python" ,
185+ "nbconvert_exporter" : " python" ,
186+ "pygments_lexer" : " ipython3" ,
187+ "version" : " 3.7.3"
188+ }
189+ },
190+ "nbformat" : 4 ,
191+ "nbformat_minor" : 4
192+ }
Original file line number Diff line number Diff line change 1+ {
2+ "cells" : [
3+ {
4+ "cell_type" : " code" ,
5+ "execution_count" : 1 ,
6+ "metadata" : {},
7+ "outputs" : [],
8+ "source" : [
9+ " # normal style"
10+ ]
11+ },
12+ {
13+ "cell_type" : " code" ,
14+ "execution_count" : 2 ,
15+ "metadata" : {},
16+ "outputs" : [],
17+ "source" : [
18+ " def fonk1(x):\n " ,
19+ " return x * 2"
20+ ]
21+ },
22+ {
23+ "cell_type" : " code" ,
24+ "execution_count" : 3 ,
25+ "metadata" : {},
26+ "outputs" : [],
27+ "source" : [
28+ " x = fonk1(4)"
29+ ]
30+ },
31+ {
32+ "cell_type" : " code" ,
33+ "execution_count" : 4 ,
34+ "metadata" : {},
35+ "outputs" : [
36+ {
37+ "data" : {
38+ "text/plain" : [
39+ " 8"
40+ ]
41+ },
42+ "execution_count" : 4 ,
43+ "metadata" : {},
44+ "output_type" : " execute_result"
45+ }
46+ ],
47+ "source" : [
48+ " x"
49+ ]
50+ },
51+ {
52+ "cell_type" : " code" ,
53+ "execution_count" : 5 ,
54+ "metadata" : {},
55+ "outputs" : [],
56+ "source" : [
57+ " # Lambda style"
58+ ]
59+ },
60+ {
61+ "cell_type" : " code" ,
62+ "execution_count" : 6 ,
63+ "metadata" : {},
64+ "outputs" : [],
65+ "source" : [
66+ " fonk2 = lambda x : x * 2"
67+ ]
68+ },
69+ {
70+ "cell_type" : " code" ,
71+ "execution_count" : 7 ,
72+ "metadata" : {},
73+ "outputs" : [
74+ {
75+ "name" : " stdout" ,
76+ "output_type" : " stream" ,
77+ "text" : [
78+ " 8\n "
79+ ]
80+ }
81+ ],
82+ "source" : [
83+ " print(fonk2(4))"
84+ ]
85+ },
86+ {
87+ "cell_type" : " code" ,
88+ "execution_count" : 10 ,
89+ "metadata" : {},
90+ "outputs" : [],
91+ "source" : [
92+ " isEven = lambda n : n % 2 == 0"
93+ ]
94+ },
95+ {
96+ "cell_type" : " code" ,
97+ "execution_count" : 11 ,
98+ "metadata" : {},
99+ "outputs" : [
100+ {
101+ "name" : " stdout" ,
102+ "output_type" : " stream" ,
103+ "text" : [
104+ " False\n "
105+ ]
106+ }
107+ ],
108+ "source" : [
109+ " print(isEven(3))"
110+ ]
111+ },
112+ {
113+ "cell_type" : " code" ,
114+ "execution_count" : 12 ,
115+ "metadata" : {},
116+ "outputs" : [
117+ {
118+ "name" : " stdout" ,
119+ "output_type" : " stream" ,
120+ "text" : [
121+ " even number\n "
122+ ]
123+ }
124+ ],
125+ "source" : [
126+ " if(isEven(6)):\n " ,
127+ " print(\" even number\" )"
128+ ]
129+ },
130+ {
131+ "cell_type" : " markdown" ,
132+ "metadata" : {},
133+ "source" : [
134+ " **Note**: In general,Lambda function uses to write little function instead of (def function....)"
135+ ]
136+ },
137+ {
138+ "cell_type" : " code" ,
139+ "execution_count" : 15 ,
140+ "metadata" : {},
141+ "outputs" : [],
142+ "source" : [
143+ " reverseString = lambda s : s[::-1]"
144+ ]
145+ },
146+ {
147+ "cell_type" : " code" ,
148+ "execution_count" : 16 ,
149+ "metadata" : {},
150+ "outputs" : [
151+ {
152+ "name" : " stdout" ,
153+ "output_type" : " stream" ,
154+ "text" : [
155+ " egaugnaL gnimmargorP nohtyP\n "
156+ ]
157+ }
158+ ],
159+ "source" : [
160+ " print(reverseString(\" Python Programming Language\" ))"
161+ ]
162+ },
163+ {
164+ "cell_type" : " code" ,
165+ "execution_count" : null ,
166+ "metadata" : {},
167+ "outputs" : [],
168+ "source" : []
169+ }
170+ ],
171+ "metadata" : {
172+ "kernelspec" : {
173+ "display_name" : " Python 3" ,
174+ "language" : " python" ,
175+ "name" : " python3"
176+ },
177+ "language_info" : {
178+ "codemirror_mode" : {
179+ "name" : " ipython" ,
180+ "version" : 3
181+ },
182+ "file_extension" : " .py" ,
183+ "mimetype" : " text/x-python" ,
184+ "name" : " python" ,
185+ "nbconvert_exporter" : " python" ,
186+ "pygments_lexer" : " ipython3" ,
187+ "version" : " 3.7.3"
188+ }
189+ },
190+ "nbformat" : 4 ,
191+ "nbformat_minor" : 4
192+ }
You can’t perform that action at this time.
0 commit comments