HW2 Steps

Step 1:

Read file; line by line;

split each line into words;

for each word; add the word to a Python dictionary called

    word_pos_dict 

    where KEY is the word; VALUE is a list of positions

print dictionary

Step 2:

use the dictionary, word_pos_dict, to recreate the song; construct a

 new dictionary, called linear_dict, whose KEY will be positions 

   1,2,3,…. VALUE is the word that appears in that position

use linear_dict to print the song

Step 3: Print # unique words

Step 4: Print most frequent word

In [1]:
show databases
Database
information_schema
raj
In [2]:
create database company
(1044, "Access denied for user 'raj'@'localhost' to database 'company'")
In [3]:
show databases
Database
company
information_schema
raj
In [4]:
use company
yes
In [5]:
CREATE TABLE CUSTOMERS(
   ID   INT              NOT NULL,
   NAME VARCHAR (20)     NOT NULL,
   AGE  INT              NOT NULL,
   ADDRESS  CHAR (25) ,
   SALARY   DECIMAL (18, 2),       
   PRIMARY KEY (ID)
);
yes
In [7]:
exit;
(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")
In [8]:
show databases
Database
company
information_schema
raj
In [ ]: