You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.6 KiB
Plaintext
72 lines
1.6 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "5688f740-c1a2-4271-880d-2be65c748d94",
|
|
"metadata": {},
|
|
"source": [
|
|
"# REVERSE!"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"id": "df889e4f-3ccc-4411-b4c7-53c8098661c9",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from textblob import TextBlob\n",
|
|
"\n",
|
|
"def reverse (inputz: str) -> str:\n",
|
|
" \"\"\"Reverse the input sentence by sentence\"\"\"\n",
|
|
" blob = TextBlob(inputz)\n",
|
|
" return \"\\n\".join(str(reversed(blob.sentences)))\n",
|
|
" \n",
|
|
" # return \" \".join(reversed(inputz.split()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"id": "c481d133-0fc4-4046-8f50-0e5cea1c0e11",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"'<\\nl\\ni\\ns\\nt\\n_\\nr\\ne\\nv\\ne\\nr\\ns\\ne\\ni\\nt\\ne\\nr\\na\\nt\\no\\nr\\n \\no\\nb\\nj\\ne\\nc\\nt\\n \\na\\nt\\n \\n0\\nx\\na\\nc\\n4\\na\\nf\\n3\\n9\\n0\\n>'"
|
|
]
|
|
},
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"reverse(\"hello world\")"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.7.3"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|