{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"HW2 Steps \n",
"\n",
"Step 1: \n",
"\n",
" Read file; line by line; \n",
"\n",
" split each line into words;\n",
"\n",
" for each word; add the word to a Python dictionary called \n",
"\n",
" word_pos_dict \n",
"\n",
" where KEY is the word; VALUE is a list of positions\n",
"\n",
" print dictionary\n",
"\n",
" \n",
"\n",
"Step 2:\n",
"\n",
" use the dictionary, word_pos_dict, to recreate the song; construct a \n",
"\n",
" new dictionary, called linear_dict, whose KEY will be positions \n",
"\n",
" 1,2,3,…. VALUE is the word that appears in that position\n",
"\n",
" use linear_dict to print the song\n",
"\n",
" \n",
"\n",
"Step 3: Print # unique words\n",
"\n",
"Step 4: Print most frequent word\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
" \n",
" Database | \n",
"
\n",
" \n",
" information_schema | \n",
"
\n",
" \n",
" raj | \n",
"
\n",
"
"
]
},
"metadata": {},
"output_type": "display_data",
"source": "kernel"
}
],
"source": [
"show databases"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"(1044, \"Access denied for user 'raj'@'localhost' to database 'company'\")"
]
},
"metadata": {},
"output_type": "display_data",
"source": "kernel"
}
],
"source": [
"create database company"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" Database | \n",
"
\n",
" \n",
" company | \n",
"
\n",
" \n",
" information_schema | \n",
"
\n",
" \n",
" raj | \n",
"
\n",
"
"
]
},
"metadata": {},
"output_type": "display_data",
"source": "kernel"
}
],
"source": [
"show databases"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"yes"
]
},
"metadata": {},
"output_type": "display_data",
"source": "kernel"
}
],
"source": [
"use company"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"yes"
]
},
"metadata": {},
"output_type": "display_data",
"source": "kernel"
}
],
"source": [
"CREATE TABLE CUSTOMERS(\n",
" ID INT NOT NULL,\n",
" NAME VARCHAR (20) NOT NULL,\n",
" AGE INT NOT NULL,\n",
" ADDRESS CHAR (25) ,\n",
" SALARY DECIMAL (18, 2), \n",
" PRIMARY KEY (ID)\n",
");"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"(1064, \"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'exit' at line 1\")"
]
},
"metadata": {},
"output_type": "display_data",
"source": "kernel"
}
],
"source": [
"exit;"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" Database | \n",
"
\n",
" \n",
" company | \n",
"
\n",
" \n",
" information_schema | \n",
"
\n",
" \n",
" raj | \n",
"
\n",
"
"
]
},
"metadata": {},
"output_type": "display_data",
"source": "kernel"
}
],
"source": [
"show databases"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Mysql",
"language": "mysql",
"name": "jupyter-mysql-kernel"
},
"language_info": {
"file_extension": ".sql",
"mimetype": "text/x-sh",
"name": "mysql"
}
},
"nbformat": 4,
"nbformat_minor": 4
}