Answer To: SMITH0.88085 JOHNSON0.68844 WILLIAMS0.56866 BROWN0.51162 JONES0.50517 MILLER0.41807...
Sudipta answered on Oct 07 2021
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Keep both the notebook file and the last.txt file in the same directory"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import csv\n",
"import fileinput\n",
"import re"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"14963\n",
"2002\n",
"1001\n",
"42\n",
"81\n",
"16\n",
"64\n",
"438\n",
"0\n",
"ZUNIGA\n",
"ABBOTT\n",
"FITZ-PATRICK\n",
"O\n"
]
}
],
"source": [
"#open the file\n",
"file=open(\"last.txt\",\"r\")\n",
"data=file.read()\n",
"\n",
"#number of characters\n",
"ans3=len(data)\n",
"print(ans3)\n",
"\n",
"#number of words\n",
"words=data.split()\n",
"ans4=len(words)\n",
...