File tree 1 file changed +73
-2
lines changed
1 file changed +73
-2
lines changed Original file line number Diff line number Diff line change 965
965
},
966
966
{
967
967
"cell_type" : " code" ,
968
- "execution_count" : null ,
968
+ "execution_count" : 17 ,
969
969
"id" : " 77e7a1bb" ,
970
970
"metadata" : {},
971
971
"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" : [],
972
1043
"source" : []
973
1044
}
974
1045
],
975
1046
"metadata" : {
976
1047
"kernelspec" : {
977
- "display_name" : " Python 3.9.12 ('base' )" ,
1048
+ "display_name" : " Python 3 (ipykernel )" ,
978
1049
"language" : " python" ,
979
1050
"name" : " python3"
980
1051
},
You can’t perform that action at this time.
0 commit comments