Skip to content

Commit 007ae5e

Browse files
committed
Python basics
1 parent 7008128 commit 007ae5e

File tree

1 file changed

+232
-0
lines changed

1 file changed

+232
-0
lines changed

01.Python Basics.ipynb

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,238 @@
258258
"print(x, y)"
259259
]
260260
},
261+
{
262+
"cell_type": "code",
263+
"execution_count": null,
264+
"metadata": {},
265+
"outputs": [],
266+
"source": [
267+
"x, y = 2, 6\n",
268+
"x, y = y, x + 2\n",
269+
"print(x, y)"
270+
]
271+
},
272+
{
273+
"cell_type": "code",
274+
"execution_count": 1,
275+
"metadata": {},
276+
"outputs": [
277+
{
278+
"data": {
279+
"text/plain": [
280+
"9.8"
281+
]
282+
},
283+
"execution_count": 1,
284+
"metadata": {},
285+
"output_type": "execute_result"
286+
}
287+
],
288+
"source": [
289+
"4.6+5.2"
290+
]
291+
},
292+
{
293+
"cell_type": "code",
294+
"execution_count": 2,
295+
"metadata": {},
296+
"outputs": [
297+
{
298+
"data": {
299+
"text/plain": [
300+
"3"
301+
]
302+
},
303+
"execution_count": 2,
304+
"metadata": {},
305+
"output_type": "execute_result"
306+
}
307+
],
308+
"source": [
309+
"2+1"
310+
]
311+
},
312+
{
313+
"cell_type": "code",
314+
"execution_count": 3,
315+
"metadata": {},
316+
"outputs": [
317+
{
318+
"data": {
319+
"text/plain": [
320+
"2.0"
321+
]
322+
},
323+
"execution_count": 3,
324+
"metadata": {},
325+
"output_type": "execute_result"
326+
}
327+
],
328+
"source": [
329+
"2/1"
330+
]
331+
},
332+
{
333+
"cell_type": "code",
334+
"execution_count": 4,
335+
"metadata": {},
336+
"outputs": [
337+
{
338+
"data": {
339+
"text/plain": [
340+
"6"
341+
]
342+
},
343+
"execution_count": 4,
344+
"metadata": {},
345+
"output_type": "execute_result"
346+
}
347+
],
348+
"source": [
349+
"2*3"
350+
]
351+
},
352+
{
353+
"cell_type": "code",
354+
"execution_count": 5,
355+
"metadata": {},
356+
"outputs": [
357+
{
358+
"data": {
359+
"text/plain": [
360+
"1"
361+
]
362+
},
363+
"execution_count": 5,
364+
"metadata": {},
365+
"output_type": "execute_result"
366+
}
367+
],
368+
"source": [
369+
"10%3"
370+
]
371+
},
372+
{
373+
"cell_type": "code",
374+
"execution_count": 6,
375+
"metadata": {},
376+
"outputs": [
377+
{
378+
"data": {
379+
"text/plain": [
380+
"-15"
381+
]
382+
},
383+
"execution_count": 6,
384+
"metadata": {},
385+
"output_type": "execute_result"
386+
}
387+
],
388+
"source": [
389+
"10-25"
390+
]
391+
},
392+
{
393+
"cell_type": "code",
394+
"execution_count": 7,
395+
"metadata": {},
396+
"outputs": [
397+
{
398+
"data": {
399+
"text/plain": [
400+
"11"
401+
]
402+
},
403+
"execution_count": 7,
404+
"metadata": {},
405+
"output_type": "execute_result"
406+
}
407+
],
408+
"source": [
409+
"7 + 2 + 5 - 3"
410+
]
411+
},
412+
{
413+
"cell_type": "code",
414+
"execution_count": 8,
415+
"metadata": {},
416+
"outputs": [
417+
{
418+
"data": {
419+
"text/plain": [
420+
"20"
421+
]
422+
},
423+
"execution_count": 8,
424+
"metadata": {},
425+
"output_type": "execute_result"
426+
}
427+
],
428+
"source": [
429+
"(2 + 3)*4"
430+
]
431+
},
432+
{
433+
"cell_type": "code",
434+
"execution_count": 10,
435+
"metadata": {},
436+
"outputs": [],
437+
"source": [
438+
"x = \"hello\"\n",
439+
"y = 'world'"
440+
]
441+
},
442+
{
443+
"cell_type": "code",
444+
"execution_count": 11,
445+
"metadata": {},
446+
"outputs": [
447+
{
448+
"data": {
449+
"text/plain": [
450+
"'helloworld'"
451+
]
452+
},
453+
"execution_count": 11,
454+
"metadata": {},
455+
"output_type": "execute_result"
456+
}
457+
],
458+
"source": [
459+
"x+y"
460+
]
461+
},
462+
{
463+
"cell_type": "code",
464+
"execution_count": 19,
465+
"metadata": {},
466+
"outputs": [],
467+
"source": [
468+
"def square(x):\n",
469+
" =x+x\n",
470+
" return(y)"
471+
]
472+
},
473+
{
474+
"cell_type": "code",
475+
"execution_count": 20,
476+
"metadata": {},
477+
"outputs": [
478+
{
479+
"data": {
480+
"text/plain": [
481+
"'hellohello'"
482+
]
483+
},
484+
"execution_count": 20,
485+
"metadata": {},
486+
"output_type": "execute_result"
487+
}
488+
],
489+
"source": [
490+
"square(x)"
491+
]
492+
},
261493
{
262494
"cell_type": "code",
263495
"execution_count": null,

0 commit comments

Comments
 (0)