Skip to content

Instantly share code, notes, and snippets.

@wupeixian
Last active February 15, 2023 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wupeixian/76181a116f430d6f01bbd4116e91f42e to your computer and use it in GitHub Desktop.
Save wupeixian/76181a116f430d6f01bbd4116e91f42e to your computer and use it in GitHub Desktop.
Assignment2
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 75,
"id": "fbc463e2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"from Hunxi ouroboros shan, symbol is bodies path\n",
"magical lived the to that adopted shan Hermeticism\n",
"Feiyi ground Western term Mountains ???o '-eating'. glided\n",
"its death, a cyclic in distinctive motion is\n",
"however, it transmigration connection biting in created with\n",
"a yonic related the but symbol are well\n"
]
}
],
"source": [
"import random\n",
"import re\n",
"import textwrap\n",
"\n",
"text1 = open(\"feiyi.txt\").read()\n",
"text2 = open(\"ouroboros.txt\").read()\n",
"\n",
"words1 = text1.split()\n",
"words2 = text2.split()\n",
"\n",
"len1 = len(words1)\n",
"list1 = random.sample(words1,10)\n",
"\n",
"len2 = len(words2)\n",
"list2 = random.sample(words2,10)\n",
"\n",
"result1 = list1 + list2\n",
"\n",
"random.shuffle(result1)\n",
"##print(textwrap.fill(\" \".join(result1)))\n",
"\n",
"for i in range(0,len1,20):\n",
" line = random.sample(words1[i:i+20],5)+ random.sample(words2[i:i+20],3)\n",
" random.shuffle(line)\n",
" print(textwrap.fill(\" \".join(line)))\n",
" "
]
}
],
"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.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment