Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 41 additions & 9 deletions your-code/Q3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand All @@ -22,7 +22,7 @@
"[2, 12, 30]"
]
},
"execution_count": 11,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -32,6 +32,7 @@
"\n",
"def multiply(num_tuple):\n",
" return num_tuple[0]*num_tuple[1]\n",
"\n",
"list(map(multiply, items))"
]
},
Expand Down Expand Up @@ -85,12 +86,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 4, 5]\n"
]
}
],
"source": [
"numbers = [1, 4, -1, -100, 0, 5, -99]\n",
"\n",
"positive_numbers = list(filter(lambda x: x > 0, numbers))\n",
"print(positive_numbers)\n",
"\n",
"# Enter your code below"
]
},
Expand All @@ -113,15 +125,35 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 142,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"'good morning everyone'"
]
},
"execution_count": 142,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import langdetect\n",
"from functools import reduce\n",
"words = ['good morning', '早上好', 'доброго', 'おはようございます', 'everyone', '大家', 'каждый', 'みんな']\n",
"\n",
"# Enter your code below"
"words = ['good morning', '早上好', 'доброго', 'おはようございます', \n",
" 'everyone', '大家', 'каждый', 'みんな'] \n",
"lista = []\n",
"for palabra in words:\n",
" if (langdetect.detect(palabra)=='en') == True:\n",
" lista.append(palabra)\n",
" else:\n",
" continue\n",
"\n",
"reduce(lambda x, y: x + ' ' + y, lista)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -199,7 +231,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
"version": "3.8.8"
}
},
"nbformat": 4,
Expand Down
Loading