8000 changes · sru0309/python_practices@c2082cc · GitHub
[go: up one dir, main page]

Skip to content

Commit c2082cc

Browse files
committed
changes
1 parent 2a66a86 commit c2082cc

File tree

4 files changed

+95
-8
lines changed

4 files changed

+95
-8
lines changed

01-python-practices.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,7 @@
305305
"id": "cc8b6bcc",
306306
"metadata": {},
307307
"outputs": [],
308-
"source": [
309-
"##"
310-
]
308+
"source": []
311309
}
312310
],
313311
"metadata": {

02-python-strings.ipynb

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,68 @@
436436
},
437437
{
438438
"cell_type": "code",
439-
"execution_count": null,
439+
"execution_count": 4,
440440
"id": "08f1d5e8",
441441
"metadata": {},
442+
"outputs": [
443+
{
444+
"ename": "NameError",
445+
"evalue": "name 'a' is not defined",
446+
"output_type": "error",
447+
"traceback": [
448+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
449+
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
450+
"\u001b[1;32md:\\Python\\python_practice\\02-python-strings.ipynb Cell 17\u001b[0m in \u001b[0;36m<cell line: 8>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/d%3A/Python/python_practice/02-python-strings.ipynb#X22sZmlsZQ%3D%3D?line=5'>6</a>\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m <a href='vscode-notebook-cell:/d%3A/Python/python_practice/02-python-strings.ipynb#X22sZmlsZQ%3D%3D?line=6'>7</a>\u001b[0m \u001b[39mreturn\u001b[39;00m b\n\u001b[1;32m----> <a href='vscode-notebook-cell:/d%3A/Python/python_practice/02-python-strings.ipynb#X22sZmlsZQ%3D%3D?line=7'>8</a>\u001b[0m \u001b[39mprint\u001b[39m(maximum(a,b))\n",
451+
"\u001b[1;31mNameError\u001b[0m: name 'a' is not defined"
452+
]
453+
}
454+
],
455+
"source": [
456+
"def maximum(a,b):\n",
457+
" a = 8\n",
458+
" b = 9\n",
459+
" if a>=b:\n",
460+
" return a\n",
461+
" else:\n",
462+
" return b\n",
463+
"print(maximum(a,b)) "
464+
]
465+
},
466+
{
467+
"cell_type": "code",
468+
"execution_count": 9,
469+
"id": "ed0baa1b",
470+
"metadata": {},
471+
"outputs": [
472+
{
473+
"name": "stdout",
474+
"output_type": "stream",
475+
"text": [
476+
"factorial of 5 is 120\n"
477+
]
478+
}
479+
],
480+
"source": [
481+
"def factorial(n):\n",
482+
" if n < 0:\n",
483+
" return 0\n",
484+
" elif n ==0 or n==1:\n",
485+
" return 1\n",
486+
" else:\n",
487+
" fact = 1\n",
488+
" while (n > 1):\n",
489+
" fact*= n \n",
490+
" n-= 1\n",
491+
" return fact\n",
492+
"num = 5\n",
493+
"print(\"factorial of \",num,\"is\",factorial(num))"
494+
]
495+
},
496+
{
497+
"cell_type": "code",
498+
"execution_count": null,
499+
"id": "fe7b3336",
500+
"metadata": {},
442501
"outputs": [],
443502
"source": []
444503
}

04-python-lists.ipynb

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,11 +610,39 @@
610610
},
611611
{
612612
"cell_type": "code",
613-
"execution_count": null,
613+
"execution_count": 3,
614614
"metadata": {},
615-
"outputs": [],
615+
"outputs": [
616+
{
617+
"name": "stdout",
618+
"output_type": "stream",
619+
"text": [
620+
"('pink', 'black')\n"
621+
]
622+
}
623+
],
624+
"source": [
625+
"listx =[\"pink\",\"black\"]\n",
626+
"tuplex=tuple(listx)\n",
627+
"print(tuplex)"
628+
]
629+
},
630+
{
631+
"cell_type": "code",
632+
"execution_count": 5,
633+
"metadata": {},
634+
"outputs": [
635+
{
636+
"name": "stdout",
637+
"output_type": "stream",
638+
"text": [
639+
"pinkblack\n"
640+
]
641+
}
642+
],
616643
"source": [
617-
"#"
644+
"str = ''.join(tuplex)\n",
645+
"print(str)"
618646
]
619647
}
620648
],

10-datetime-module.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@
188188
"execution_count": null,
189189
"metadata": {},
190190
"outputs": [],
191-
"source": []
191+
"source": [
192+
"#"
193+
]
192194
}
193195
],
194196
"metadata": {

0 commit comments

Comments
 (0)
0