Skip to content

Commit cc6b5ad

Browse files
committed
module
1 parent cfa7cc2 commit cc6b5ad

File tree

1 file changed

+73
-2
lines changed

1 file changed

+73
-2
lines changed

module_practice.ipynb

+73-2
Original file line numberDiff line numberDiff line change
@@ -965,16 +965,87 @@
965965
},
966966
{
967967
"cell_type": "code",
968-
"execution_count": null,
968+
"execution_count": 17,
969969
"id": "77e7a1bb",
970970
"metadata": {},
971971
"outputs": [],
972+
"source": [
973+
"import random\n",
974+
"def random_line(*paragraph):\n",
975+
" choice=random.choices([\"hello\",\"hi\",\"hey\"])\n",
976+
" print(choice)"
977+
]
978+
},
979+
{
980+
"cell_type": "code",
981+
"execution_count": 18,
982+
"id": "8799e424",
983+
"metadata": {},
984+
"outputs": [
985+
{
986+
"name": "stdout",
987+
"output_type": "stream",
988+
"text": [
989+
"['hi']\n"
990+
]
991+
}
992+
],
993+
"source": [
994+
"random_line()"
995+
]
996+
},
997+
{
998+
"cell_type": "code",
999+
"execution_count": 20,
1000+
"id": "e6ae0d6c",
1001+
"metadata": {},
1002+
"outputs": [
1003+
{
1004+
"name": "stdout",
1005+
"output_type": "stream",
1006+
"text": [
1007+
"['hello']\n"
1008+
]
1009+
}
1010+
],
1011+
"source": [
1012+
"random_line()"
1013+
]
1014+
},
1015+
{
1016+
"cell_type": "code",
1017+
"execution_count": 29,
1018+
"id": "47c5ec18",
1019+
"metadata": {},
1020+
"outputs": [
1021+
{
1022+
"name": "stdout",
1023+
"output_type": "stream",
1024+
"text": [
1025+
"### Conditional statements\n"
1026+
]
1027+
}
1028+
],
1029+
"source": [
1030+
"import random\n",
1031+
"def random_line(fname):\n",
1032+
" lines = open(fname).read().splitlines()\n",
1033+
" return random.choice(lines)\n",
1034+
"print(random_line('Readme.md'))\n"
1035+
]
1036+
},
1037+
{
1038+
"cell_type": "code",
1039+
"execution_count": null,
1040+
"id": "36064499",
1041+
"metadata": {},
1042+
"outputs": [],
9721043
"source": []
9731044
}
9741045
],
9751046
"metadata": {
9761047
"kernelspec": {
977-
"display_name": "Python 3.9.12 ('base')",
1048+
"display_name": "Python 3 (ipykernel)",
9781049
"language": "python",
9791050
"name": "python3"
9801051
},

0 commit comments

Comments
 (0)