update examples
Browse files- utils/examples.json +14 -19
utils/examples.json
CHANGED
|
@@ -1,43 +1,38 @@
|
|
| 1 |
[
|
| 2 |
-
{
|
| 3 |
-
"name": "Hello World!",
|
| 4 |
-
"value": "def print_hello_world():\n \"\"\"Print 'Hello World!'.\"\"\"",
|
| 5 |
-
"length": 8
|
| 6 |
-
},
|
| 7 |
{
|
| 8 |
"name": "Scikit-Learn",
|
| 9 |
"value": "import numpy as np\nfrom sklearn.ensemble import RandomForestClassifier\n\n# create training data\nX = np.random.randn(100, 100)\ny = np.random.randint(0, 1, 100)\n\n# setup train test split",
|
| 10 |
"length": 96
|
| 11 |
},
|
| 12 |
{
|
| 13 |
-
"name": "
|
| 14 |
-
"value": "
|
| 15 |
-
"length":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
},
|
| 17 |
{
|
| 18 |
-
"name": "
|
| 19 |
"value": "def is_in_list(L, e):\n \"\"\"Find if list L contains the element e.\"\"\"",
|
| 20 |
"length": 32
|
| 21 |
},
|
| 22 |
-
{
|
| 23 |
-
"name": "Python to Numpy",
|
| 24 |
-
"value": "# native Python:\ndef mean(a):\n return sum(a)/len(a)\n\n# with numpy:\nimport numpy as np\n\ndef mean(a):",
|
| 25 |
-
"length": 16
|
| 26 |
-
},
|
| 27 |
{
|
| 28 |
"name": "unittest",
|
| 29 |
"value": "def is_even(value):\n \"\"\"Returns True if value is an even number.\"\"\"\n return value % 2 == 0\n\n# setup unit tests for is_even\nimport unittest",
|
| 30 |
"length": 64
|
| 31 |
|
| 32 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
{
|
| 34 |
"name": "Pandas",
|
| 35 |
"value": "# load dataframe from csv\ndf = pd.read_csv(filename)\n\n# columns: \"age_group\", \"income\"\n# calculate average income per age group",
|
| 36 |
"length": 16
|
| 37 |
},
|
| 38 |
-
{
|
| 39 |
-
"name": "Transformers",
|
| 40 |
-
"value": "from transformers import AutoTokenizer, AutoModelForSequenceClassification\n\n# build a BERT classifier",
|
| 41 |
-
"length": 48
|
| 42 |
-
}
|
| 43 |
]
|
|
|
|
| 1 |
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
{
|
| 3 |
"name": "Scikit-Learn",
|
| 4 |
"value": "import numpy as np\nfrom sklearn.ensemble import RandomForestClassifier\n\n# create training data\nX = np.random.randn(100, 100)\ny = np.random.randint(0, 1, 100)\n\n# setup train test split",
|
| 5 |
"length": 96
|
| 6 |
},
|
| 7 |
{
|
| 8 |
+
"name": "Transformers",
|
| 9 |
+
"value": "from transformers import AutoTokenizer, AutoModelForSequenceClassification\n\n# build a BERT classifier",
|
| 10 |
+
"length": 48
|
| 11 |
+
}
|
| 12 |
+
{
|
| 13 |
+
"name": "Count words",
|
| 14 |
+
"value": "def count_words(filename):\n \"\"\"Count the number of occurrences of each word in the file\"\"\""
|
| 15 |
+
"length": 60
|
| 16 |
},
|
| 17 |
{
|
| 18 |
+
"name": "Is e in L",
|
| 19 |
"value": "def is_in_list(L, e):\n \"\"\"Find if list L contains the element e.\"\"\"",
|
| 20 |
"length": 32
|
| 21 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
{
|
| 23 |
"name": "unittest",
|
| 24 |
"value": "def is_even(value):\n \"\"\"Returns True if value is an even number.\"\"\"\n return value % 2 == 0\n\n# setup unit tests for is_even\nimport unittest",
|
| 25 |
"length": 64
|
| 26 |
|
| 27 |
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Pizza Problem",
|
| 30 |
+
"value": "def exercise():\n \"\"\"Marie ordered one chicken meal that costs 12 dollars, and some boxes of pizza. Marie paid a total of 44 dollars. How many boxes of pizza did Marie order if each box costs 8 dollars?\"\"\",
|
| 31 |
+
"length": 56
|
| 32 |
+
},
|
| 33 |
{
|
| 34 |
"name": "Pandas",
|
| 35 |
"value": "# load dataframe from csv\ndf = pd.read_csv(filename)\n\n# columns: \"age_group\", \"income\"\n# calculate average income per age group",
|
| 36 |
"length": 16
|
| 37 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
]
|