Skip to content

Commit b2a8a67

Browse files
committed
started solving chapter 6 problems
1 parent 0e6ddfb commit b2a8a67

File tree

8 files changed

+7796
-0
lines changed

8 files changed

+7796
-0
lines changed

Chapter 6/problems/Problem6_20.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def reverse(phonebook):
2+
keys = phonebook.keys()
3+
newdic = {}
4+
for key in keys:
5+
newdic[phonebook[key]] = key
6+
return newdic

Chapter 6/problems/Problem6_21.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def ticker(filename):
2+
file = open(filename)
3+
content = file.read()
4+
file.close()
5+
content.splitlines()
6+
dictionary = {}
7+
for i in range(0, len(content)-1, 2):
8+
dictionary[content[i]] = content[i+1]
9+
resp = 'a'
10+
while resp != '':
11+
resp = input('Enter company name:')
12+
if resp in dictionary.keys():
13+
print('Ticker symbol:{}'.format(dictionary[resp]))
14+

Chapter 6/problems/chinese.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
你好世界!
2+
3+
(translation: Hello World!)

Chapter 6/problems/clear.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Spy Manual (Top secret)
2+
3+
1. Always wear a dark coat.
4+
2. Always wear your agency's badge on your coat.

Chapter 6/problems/document.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a text document
2+
posted on the
3+
WWW.

Chapter 6/problems/frankenstein.txt

Lines changed: 7440 additions & 0 deletions
Large diffs are not rendered by default.

Chapter 6/problems/nasdaq.txt

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
ACTIVISION INC
2+
ATVI
3+
ADOBE SYS INC
4+
ADBE
5+
ALTERA CORP
6+
ALTR
7+
AMAZON
8+
AMZN
9+
AMERICAN POWER CONVER CORP
10+
APCC
11+
AMGEN
12+
AMGN
13+
APOLLO GROUP-A
14+
APOL
15+
APPLE COMPUTER
16+
AAPL
17+
APPLIED MATERIAL
18+
AMAT
19+
ATI TECHNOLOGIES
20+
ATYT
21+
AUTODESK
22+
ADSK
23+
BEA SYSTEMS
24+
BEAS
25+
BED BATH &BEYOND
26+
BBBY
27+
BIOGEN
28+
BIIB
29+
BIOMET
30+
BMET
31+
BROADCOM CORP-A
32+
BRCM
33+
Cadence Design Systems Inc
34+
CDNS
35+
CDW COMPUTER CTR
36+
CDWC
37+
CELGENE CORPORATION
38+
CELG
39+
C.H. ROBINSON WORLDWIDE
40+
CHRW
41+
CHECK POINT SOFT
42+
CHKP
43+
CHECKFREE CORP
44+
CKFR
45+
CHIRON CORP
46+
CHIR
47+
CINTAS CORP
48+
CTAS
49+
CISCO SYSTEMS
50+
CSCO
51+
CITRIX SYSTEMS
52+
CTXS
53+
COGNIZANT TECHNOLOGY SOLUTIONS CORP
54+
CTSH
55+
COMCAST CORPORATION
56+
CMCSA
57+
COMVERSE TECH
58+
CMVT
59+
COSTCO WHOLESALE
60+
COST
61+
DELL
62+
DELL
63+
DENTSPLY INTERNATIONAL
64+
XRAY
65+
DISCOVERY HOLDING
66+
DISCA
67+
EBAY
68+
EBAY
69+
ECHOSTAR COMM-A
70+
DISH
71+
ELECTRONIC ARTS
72+
ERTS
73+
EXPEDIA INC
74+
EXPE
75+
EXPEDITORS INTERNATIONAL
76+
EXPD
77+
EXPRESS SCRIPT-A
78+
ESRX
79+
FASTENAL COMPANY
80+
FAST
81+
FISERV
82+
FISV
83+
FLEXTRONICS INTL
84+
FLEX
85+
GARMIN LTD
86+
GRMN
87+
GENZYME-GENL DIV
88+
GENZ
89+
GILEAD SCIENCES
90+
GILD
91+
GOOGLE INC
92+
GOOG
93+
IAC/INTERACTIVE CORP
94+
IACI
95+
INTEL CORP
96+
INTC
97+
INTUIT
98+
INTU
99+
JDS UNIPHASE
100+
JDSU
101+
JUNIPER NETWORKS
102+
JNPR
103+
KLA-TENCOR CORP
104+
KLAC
105+
LAM RESEARCH CORPORATION
106+
LRCX
107+
LAMAR ADVERTISING COMPANY
108+
LAMR
109+
LIBERTY MEDIA INTERNATIONAL
110+
LBTYA
111+
LINCARE HOLDINGS
112+
LNCR
113+
LINEAR TECH CORP
114+
LLTC
115+
LM ERICSSON TELEPHONE COMPANY
116+
ERICY
117+
MARVEL TECHNOLOGY GROUP, LTD
118+
MRVL
119+
MAXIM INTEGRATED
120+
MXIM
121+
MCI
122+
MCIP
123+
MEDIMMUNE
124+
MEDI
125+
MERCURY INTERACT
126+
MERQ
127+
MICROCHIP TECH
128+
MCHP
129+
MICROSOFT CORP
130+
MSFT
131+
MONSTER WORLDWIDE INC
132+
MNST
133+
NETWORK APPLIANC
134+
NTAP
135+
NII HOLDING
136+
NIHD
137+
NOVELLUS SYS
138+
NVLS
139+
NTLI
140+
NTLI
141+
NVIDIA CORP
142+
NVDA
143+
ORACLE CORP
144+
ORCL
145+
PACCAR
146+
PCAR
147+
PATTERSON COMPANIES
148+
PDCO
149+
PATTERSON-UTI ENERGY
150+
PTEN
151+
PAYCHEX
152+
PAYX
153+
PETSMART
154+
PETM
155+
PIXAR
156+
PIXR
157+
QUALCOMM
158+
QCOM
159+
RED HAT
160+
RHAT
161+
RESEARCH IN MOTION LIMITED
162+
RIMM
163+
ROSS STORES
164+
ROST
165+
SANDISK CORPORATION
166+
SNDK
167+
SEARS HOLDINGS CORP
168+
SHLD
169+
SEPRACOR
170+
SEPR
171+
SIGMA-ALDRICH CORPORATION
172+
SEPR
173+
SIRIUS SATELLITE RADIO
174+
SIRI
175+
STAPLES
176+
SPLS
177+
STARBUCKS CORP
178+
SBUX
179+
SUN MICROSYSTEMS
180+
SUNW
181+
SYMANTEC CORP
182+
SYMC
183+
TELLABS
184+
TLAB
185+
TEVA PHARMACEUTICAL INDUSTRIES
186+
TEVA
187+
URBAN OUTFITTERS
188+
URBN
189+
VERISIGN
190+
VRSN
191+
WHOLE FOODS MARKET
192+
WFMI
193+
WYNN RESORTS, LTD
194+
WYNN
195+
XILINX
196+
XLNX
197+
XM SATELLITE RADIO HOLDINGS
198+
XMSR
199+
YAHOO
200+
YHOO
201+

Chapter 6/problems/raven.txt

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
Once upon a midnight dreary, while I pondered weak and weary,
2+
Over many a quaint and curious volume of forgotten lore,
3+
While I nodded, nearly napping, suddenly there came a tapping,
4+
As of some one gently rapping, rapping at my chamber door.
5+
`'Tis some visitor,' I muttered, `tapping at my chamber door -
6+
Only this, and nothing more.'
7+
8+
Ah, distinctly I remember it was in the bleak December,
9+
And each separate dying ember wrought its ghost upon the floor.
10+
Eagerly I wished the morrow; - vainly I had sought to borrow
11+
From my books surcease of sorrow - sorrow for the lost Lenore -
12+
For the rare and radiant maiden whom the angels named Lenore -
13+
Nameless here for evermore.
14+
15+
And the silken sad uncertain rustling of each purple curtain
16+
Thrilled me - filled me with fantastic terrors never felt before;
17+
So that now, to still the beating of my heart, I stood repeating
18+
`'Tis some visitor entreating entrance at my chamber door -
19+
Some late visitor entreating entrance at my chamber door; -
20+
This it is, and nothing more,'
21+
22+
Presently my soul grew stronger; hesitating then no longer,
23+
`Sir,' said I, `or Madam, truly your forgiveness I implore;
24+
But the fact is I was napping, and so gently you came rapping,
25+
And so faintly you came tapping, tapping at my chamber door,
26+
That I scarce was sure I heard you' - here I opened wide the door; -
27+
Darkness there, and nothing more.
28+
29+
Deep into that darkness peering, long I stood there wondering, fearing,
30+
Doubting, dreaming dreams no mortal ever dared to dream before
31+
But the silence was unbroken, and the darkness gave no token,
32+
And the only word there spoken was the whispered word, `Lenore!'
33+
This I whispered, and an echo murmured back the word, `Lenore!'
34+
Merely this and nothing more.
35+
36+
Back into the chamber turning, all my soul within me burning,
37+
Soon again I heard a tapping somewhat louder than before.
38+
`Surely,' said I, `surely that is something at my window lattice;
39+
Let me see then, what thereat is, and this mystery explore -
40+
Let my heart be still a moment and this mystery explore; -
41+
'Tis the wind and nothing more!'
42+
43+
Open here I flung the shutter, when, with many a flirt and flutter,
44+
In there stepped a stately raven of the saintly days of yore.
45+
Not the least obeisance made he; not a minute stopped or stayed he;
46+
But, with mien of lord or lady, perched above my chamber door -
47+
Perched upon a bust of Pallas just above my chamber door -
48+
Perched, and sat, and nothing more.
49+
50+
Then this ebony bird beguiling my sad fancy into smiling,
51+
By the grave and stern decorum of the countenance it wore,
52+
`Though thy crest be shorn and shaven, thou,' I said, `art sure no craven.
53+
Ghastly grim and ancient raven wandering from the nightly shore -
54+
Tell me what thy lordly name is on the Night's Plutonian shore!'
55+
Quoth the raven, `Nevermore.'
56+
57+
Much I marvelled this ungainly fowl to hear discourse so plainly,
58+
Though its answer little meaning - little relevancy bore;
59+
For we cannot help agreeing that no living human being
60+
Ever yet was blessed with seeing bird above his chamber door -
61+
Bird or beast above the sculptured bust above his chamber door,
62+
With such name as `Nevermore.'
63+
64+
But the raven, sitting lonely on the placid bust, spoke only,
65+
That one word, as if his soul in that one word he did outpour.
66+
Nothing further then he uttered - not a feather then he fluttered -
67+
Till I scarcely more than muttered `Other friends have flown before -
68+
On the morrow he will leave me, as my hopes have flown before.'
69+
Then the bird said, `Nevermore.'
70+
71+
Startled at the stillness broken by reply so aptly spoken,
72+
`Doubtless,' said I, `what it utters is its only stock and store,
73+
Caught from some unhappy master whom unmerciful disaster
74+
Followed fast and followed faster till his songs one burden bore -
75+
Till the dirges of his hope that melancholy burden bore
76+
Of "Never-nevermore."'
77+
78+
But the raven still beguiling all my sad soul into smiling,
79+
Straight I wheeled a cushioned seat in front of bird and bust and door;
80+
Then, upon the velvet sinking, I betook myself to linking
81+
Fancy unto fancy, thinking what this ominous bird of yore -
82+
What this grim, ungainly, ghastly, gaunt, and ominous bird of yore
83+
Meant in croaking `Nevermore.'
84+
85+
This I sat engaged in guessing, but no syllable expressing
86+
To the fowl whose fiery eyes now burned into my bosom's core;
87+
This and more I sat divining, with my head at ease reclining
88+
On the cushion's velvet lining that the lamp-light gloated o'er,
89+
But whose velvet violet lining with the lamp-light gloating o'er,
90+
She shall press, ah, nevermore!
91+
92+
Then, methought, the air grew denser, perfumed from an unseen censer
93+
Swung by Seraphim whose foot-falls tinkled on the tufted floor.
94+
`Wretch,' I cried, `thy God hath lent thee - by these angels he has sent thee
95+
Respite - respite and nepenthe from thy memories of Lenore!
96+
Quaff, oh quaff this kind nepenthe, and forget this lost Lenore!'
97+
Quoth the raven, `Nevermore.'
98+
99+
`Prophet!' said I, `thing of evil! - prophet still, if bird or devil! -
100+
Whether tempter sent, or whether tempest tossed thee here ashore,
101+
Desolate yet all undaunted, on this desert land enchanted -
102+
On this home by horror haunted - tell me truly, I implore -
103+
Is there - is there balm in Gilead? - tell me - tell me, I implore!'
104+
Quoth the raven, `Nevermore.'
105+
106+
`Prophet!' said I, `thing of evil! - prophet still, if bird or devil!
107+
By that Heaven that bends above us - by that God we both adore -
108+
Tell this soul with sorrow laden if, within the distant Aidenn,
109+
It shall clasp a sainted maiden whom the angels named Lenore -
110+
Clasp a rare and radiant maiden, whom the angels named Lenore?'
111+
Quoth the raven, `Nevermore.'
112+
113+
`Be that word our sign of parting, bird or fiend!' I shrieked upstarting -
114+
`Get thee back into the tempest and the Night's Plutonian shore!
115+
Leave no black plume as a token of that lie thy soul hath spoken!
116+
Leave my loneliness unbroken! - quit the bust above my door!
117+
Take thy beak from out my heart, and take thy form from off my door!'
118+
Quoth the raven, `Nevermore.'
119+
120+
And the raven, never flitting, still is sitting, still is sitting
121+
On the pallid bust of Pallas just above my chamber door;
122+
And his eyes have all the seeming of a demon's that is dreaming,
123+
And the lamp-light o'er him streaming throws his shadow on the floor;
124+
And my soul from out that shadow that lies floating on the floor
125+
Shall be lifted - nevermore!

0 commit comments

Comments
 (0)