File tree Expand file tree Collapse file tree 1 file changed +95
-3
lines changed Expand file tree Collapse file tree 1 file changed +95
-3
lines changed Original file line number Diff line number Diff line change 121121 },
122122 {
123123 "cell_type" : " code" ,
124- "execution_count" : null ,
124+ "execution_count" : 16 ,
125125 "metadata" : {},
126- "outputs" : [],
127- "source" : []
126+ "outputs" : [
127+ {
128+ "name" : " stdout" ,
129+ "output_type" : " stream" ,
130+ "text" : [
131+ " Python is awesome\n "
132+ ]
133+ }
134+ ],
135+ "source" : [
136+ " x = \" awesome\"\n " ,
137+ " \n " ,
138+ " def myfunc():\n " ,
139+ " print(\" Python is \" + x)\n " ,
140+ " \n " ,
141+ " myfunc()"
142+ ]
143+ },
144+ {
145+ "cell_type" : " code" ,
146+ "execution_count" : 17 ,
147+ "metadata" : {},
148+ "outputs" : [
149+ {
150+ "name" : " stdout" ,
151+ "output_type" : " stream" ,
152+ "text" : [
153+ " 101\n " ,
154+ " I am learning Python\n " ,
155+ " 101\n "
156+ ]
157+ }
158+ ],
159+ "source" : [
160+ " # Declare a variable and initialize it\n " ,
161+ " f = 101\n " ,
162+ " print(f)\n " ,
163+ " # Global vs. local variables in functions\n " ,
164+ " def someFunction():\n " ,
165+ " # global f\n " ,
166+ " f = 'I am learning Python'\n " ,
167+ " print(f)\n " ,
168+ " someFunction()\n " ,
169+ " print(f)"
170+ ]
171+ },
172+ {
173+ "cell_type" : " code" ,
174+ "execution_count" : 18 ,
175+ "metadata" : {},
176+ "outputs" : [
177+ {
178+ "name" : " stdout" ,
179+ "output_type" : " stream" ,
180+ "text" : [
181+ " Python is fantastic\n " ,
182+ " Python is awesome\n "
183+ ]
184+ }
185+ ],
186+ "source" : [
187+ " x = \" awesome\"\n " ,
188+ " \n " ,
189+ " def myfunc():\n " ,
190+ " x = \" fantastic\"\n " ,
191+ " print(\" Python is \" + x)\n " ,
192+ " \n " ,
193+ " myfunc()\n " ,
194+ " \n " ,
195+ " print(\" Python is \" + x)"
196+ ]
197+ },
198+ {
199+ "cell_type" : " code" ,
200+ "execution_count" : 19 ,
201+ "metadata" : {},
202+ "outputs" : [
203+ {
204+ "name" : " stdout" ,
205+ "output_type" : " stream" ,
206+ "text" : [
207+ " Python is fantastic\n "
208+ ]
209+ }
210+ ],
211+ "source" : [
212+ " def myfunc():\n " ,
213+ " global x\n " ,
214+ " x = \" fantastic\"\n " ,
215+ " \n " ,
216+ " myfunc()\n " ,
217+ " \n " ,
218+ " print(\" Python is \" + x)"
219+ ]
128220 }
129221 ],
130222 "metadata" : {
You can’t perform that action at this time.
0 commit comments