Introduction to Programming Using Python 1st Edition Schneider Test Bank - Quickly Download For The Best Reading Experience
Introduction to Programming Using Python 1st Edition Schneider Test Bank - Quickly Download For The Best Reading Experience
com
https://testbankfan.com/product/introduction-to-programming-
using-python-1st-edition-schneider-test-bank/
OR CLICK BUTTON
DOWLOAD NOW
https://testbankfan.com/product/introduction-to-programming-using-
python-1st-edition-schneider-solutions-manual/
testbankfan.com
https://testbankfan.com/product/introduction-to-programming-using-
visual-basic-10th-edition-schneider-test-bank/
testbankfan.com
https://testbankfan.com/product/introduction-to-programming-using-
visual-basic-2012-9th-edition-schneider-test-bank/
testbankfan.com
https://testbankfan.com/product/litigation-paralegal-a-systems-
approach-6th-edition-mccord-solutions-manual/
testbankfan.com
Strategic Management in Action 6th Edition Coulter
Solutions Manual
https://testbankfan.com/product/strategic-management-in-action-6th-
edition-coulter-solutions-manual/
testbankfan.com
https://testbankfan.com/product/m-information-systems-2nd-edition-
baltzan-test-bank/
testbankfan.com
https://testbankfan.com/product/management-science-the-art-of-
modeling-with-spreadsheets-excel-2007-update-1st-edition-powell-test-
bank/
testbankfan.com
https://testbankfan.com/product/applied-digital-signal-processing-1st-
edition-manolakis-solutions-manual/
testbankfan.com
https://testbankfan.com/product/experience-sociology-2nd-edition-
croteau-solutions-manual/
testbankfan.com
Engineering Electromagnetics and Waves 2nd Edition Inan
Solutions Manual
https://testbankfan.com/product/engineering-electromagnetics-and-
waves-2nd-edition-inan-solutions-manual/
testbankfan.com
Chapter 5
Multiple Choice (21) WARNING: CORRECT ANSWERS ARE IN THE SAME POSITION AND TAGGED WITH **.
YOU SHOULD RANDOMIZE THE LOCATION OF THE CORRECT ANSWERS IN YOUR EXAM.
1. When reading data from a file, the open function returns a(n) __________.
a. file object **
b. file name
c. file handle
d. file tuple
3. After all the lines of a file have been read, the readline method returns __________.
a. the empty string **
b. an empty tuple
c. the value None
d. a Throwback error
4. Python uses a(n) __________ as a temporary holding place for data to be written to disk.
a. buffer **
b. temp space
c. special memory location
d. list
6. Which standard library module do you need to import in order to use the remove and rename
functions for files?
a. os **
b. file
c. path
15. To avoid a potential runtime error when opening files for reading or writing:
a. use the os.path.isfile function **
b. use the os.path.file.exists function
c. prompt the user for the action to take if the file does not exist
d. use the Boolean value try to check if the file exists
18. Each piece of data in a CSV file record is referred to as a(n) __________.
a. field **
b. record
c. tuple
d. line
19. In a dictionary, a pair such such as “dog” : “rover” is called a(n) __________.
a. item **
b. pair
c. key
d. couple
20. Which file format stores data as a sequence of types that can only be access by special readers?
a. binary **
b. text
21. In order for Python to use functions to work with binary files, you must first import which
standard library module?
a. pickle **
b. os
c. binaries
d. osfile
True/False (23)
1. After all the lines of a file have been read, the readline method returns the value None.
Answer: false
2. You must close a file in order to guarantee that all data has been physically written to the disk.
Answer: true
3. The remove and rename functions cannot be used with open files.
Answer: true
Answer: true
Answer: false
Answer: true
Answer: false
Answer: true
Answer: true
Answer: false
11. infile is a descriptive name bot not mandatory for file input usage.
Answer: true
12. An attempt to open a nonexistent file for input generates a syntax error.
Answer: false
13. If a file that already exists is opened for writing, the contents of the file will be erased.
Answer: true
Answer: false
Answer: true
Answer: true
17. The data in the fields of each record in a CSV file normally should be related.
Answer: true
Answer: true
Answer: true
Answer: false
Answer: false
Answer: true
1. Complete the following function to open the file for reading and read the contents into a single
string named contents.
def readFile(file):
Answer:
infile = open(file, ‘r’)
contents = infile.read()
2. Write a Python statement to open a file called names for writing and assign it to a variable called
outfile.
3. Write a Python statement to open a file called grades with the intent to add values to the end of
the file and assign it to a variable called outfile.
4. Write a single Python statement to convert the list [“spring”, “summer”, “fall”, “winter”] to a set
called seasons.
5. Write a single Python statement to convert the tuple (“spring”, “summer”, “fall”, “winter”) to a
set called seasons.
7. Explain the difference between a simple text file and a CSV-formatted file.
Answer: A simple text file has a single piece of data per line. A CSV-formatter file has several items
of data on each line with items separated by commas.
9. Write a Python statement to create a copy of the dictionary called dogs into a new dictionary
called canines.
11. Why can’t lists and sets serve as keys for dictionaries?
Answer: Because dictionary keys must be immutable objects. Lists and sets are mutable.
This was old honest Deckar, and the lines ought to embalm his
memory to every one who has a sense either of religion, or
philosophy, or humanity, or true genius. Nor can I help thinking,
that we may discern the traces of the influence exerted by religious
faith in the spirit of the poetry of the age of Elizabeth, in the means of
exciting terror and pity, in the delineation of the passions of grief,
remorse, love, sympathy, the sense of shame, in the fond desires, the
longings after immortality, in the heaven of hope, and the abyss of
despair it lays open to us.[12]
The literature of this age then, I would say, was strongly influenced
(among other causes), first by the spirit of Christianity, and secondly
by the spirit of Protestantism.
The effects of the Reformation on politics and philosophy may be
seen in the writings and history of the next and of the following ages.
They are still at work, and will continue to be so. The effects on the
poetry of the time were chiefly confined to the moulding of the
character, and giving a powerful impulse to the intellect of the
country. The immediate use or application that was made of religion
to subjects of imagination and fiction was not (from an obvious
ground of separation) so direct or frequent, as that which was made
of the classical and romantic literature.
For much about the same time, the rich and fascinating stores of
the Greek and Roman mythology, and those of the romantic poetry
of Spain and Italy, were eagerly explored by the curious, and thrown
open in translations to the admiring gaze of the vulgar. This last
circumstance could hardly have afforded so much advantage to the
poets of that day, who were themselves, in fact, the translators, as it
shews the general curiosity and increasing interest in such subjects,
as a prevailing feature of the times. There were translations of Tasso
by Fairfax, and of Ariosto by Harrington, of Homer and Hesiod by
Chapman, and of Virgil long before, and Ovid soon after; there was
Sir Thomas North’s translation of Plutarch, of which Shakespear has
made such admirable use in his Coriolanus and Julius Cæsar: and
Ben Jonson’s tragedies of Catiline and Sejanus may themselves be
considered as almost literal translations into verse, of Tacitus,
Sallust, and Cicero’s Orations in his consulship. Boccacio, the divine
Boccacio, Petrarch, Dante, the satirist Aretine, Machiavel,
Castiglione, and others, were familiar to our writers, and they make
occasional mention of some few French authors, as Ronsard and Du
Bartas; for the French literature had not at this stage arrived at its
Augustan period, and it was the imitation of their literature a century
afterwards, when it had arrived at its greatest height (itself copied
from the Greek and Latin), that enfeebled and impoverished our
own. But of the time that we are considering, it might be said,
without much extravagance, that every breath that blew, that every
wave that rolled to our shores, brought with it some accession to our
knowledge, which was engrafted on the national genius. In fact, all
the disposable materials that had been accumulating for a long
period of time, either in our own, or in foreign countries, were now
brought together, and required nothing more than to be wrought up,
polished, or arranged in striking forms, for ornament and use. To
this every inducement prompted, the novelty of the acquisition of
knowledge in many cases, the emulation of foreign wits, and of
immortal works, the want and the expectation of such works among
ourselves, the opportunity and encouragement afforded for their
production by leisure and affluence; and, above all, the insatiable
desire of the mind to beget its own image, and to construct out of
itself, and for the delight and admiration of the world and posterity,
that excellence of which the idea exists hitherto only in its own
breast, and the impression of which it would make as universal as the
eye of heaven, the benefit as common as the air we breathe. The first
impulse of genius is to create what never existed before: the
contemplation of that, which is so created, is sufficient to satisfy the
demands of taste; and it is the habitual study and imitation of the
original models that takes away the power, and even wish to do the
like. Taste limps after genius, and from copying the artificial models,
we lose sight of the living principle of nature. It is the effort we make,
and the impulse we acquire, in overcoming the first obstacles, that
projects us forward; it is the necessity for exertion that makes us
conscious of our strength; but this necessity and this impulse once
removed, the tide of fancy and enthusiasm, which is at first a running
stream, soon settles and crusts into the standing pool of dulness,
criticism, and virtù.
What also gave an unusual impetus to the mind of man at this
period, was the discovery of the New World, and the reading of
voyages and travels. Green islands and golden sands seemed to arise,
as by enchantment, out of the bosom of the watery waste, and invite
the cupidity, or wing the imagination of the dreaming speculator.
Fairy land was realised in new and unknown worlds. ‘Fortunate
fields and groves and flowery vales, thrice happy isles,’ were found
floating ‘like those Hesperian gardens famed of old,’ beyond Atlantic
seas, as dropt from the zenith. The people, the soil, the clime,
everything gave unlimited scope to the curiosity of the traveller and
reader. Other manners might be said to enlarge the bounds of
knowledge, and new mines of wealth were tumbled at our feet. It is
from a voyage to the Straits of Magellan that Shakespear has taken
the hint of Prospero’s Enchanted Island, and of the savage Caliban
with his god Setebos.[13] Spenser seems to have had the same feeling
in his mind in the production of his Faery Queen, and vindicates his
poetic fiction on this very ground of analogy.
‘Right well I wote, most mighty sovereign,
That all this famous antique history
Of some the abundance of an idle brain
Will judged be, and painted forgery,
Rather than matter of just memory:
Since none that breatheth living air, doth know
Where is that happy land of faery
Which I so much do vaunt, but no where show,
But vouch antiquities, which nobody can know.
Again, the heroic and martial spirit which breathes in our elder
writers, was yet in considerable activity in the reign of Elizabeth. ‘The
age of chivalry was not then quite gone, nor the glory of Europe
extinguished for ever.’ Jousts and tournaments were still common
with the nobility in England and in foreign countries: Sir Philip
Sidney was particularly distinguished for his proficiency in these
exercises (and indeed fell a martyr to his ambition as a soldier)—and
the gentle Surrey was still more famous, on the same account, just
before him. It is true, the general use of firearms gradually
superseded the necessity of skill in the sword, or bravery in the
person: and as a symptom of the rapid degeneracy in this respect, we
find Sir John Suckling soon after boasting of himself as one—
‘Who prized black eyes, and a lucky hit
At bowls, above all the trophies of wit.’
but the sound of civil combat might still be heard in the distance, the
spear glittered to the eye of memory, or the clashing of armour
struck on the imagination of the ardent and the young. They were
borderers on the savage state, on the times of war and bigotry,
though in the lap of arts, of luxury, and knowledge. They stood on
the shore and saw the billows rolling after the storm: ‘they heard the
tumult, and were still.’ The manners and out-of-door amusements
were more tinctured with a spirit of adventure and romance. The war
with wild beasts, &c. was more strenuously kept up in country sports.
I do not think we could get from sedentary poets, who had never
mingled in the vicissitudes, the dangers, or excitements of the chase,
such descriptions of hunting and other athletic games, as are to be
found in Shakespear’s Midsummer Night’s Dream, or Fletcher’s
Noble Kinsmen.
With respect to the good cheer and hospitable living of those
times, I cannot agree with an ingenious and agreeable writer of the
present day, that it was general or frequent. The very stress laid upon
certain holidays and festivals, shews that they did not keep up the
same Saturnalian licence and open house all the year round. They
reserved themselves for great occasions, and made the best amends
they could, for a year of abstinence and toil by a week of merriment
and convivial indulgence. Persons in middle life at this day, who can
afford a good dinner every day, do not look forward to it as any
particular subject of exultation: the poor peasant, who can only
contrive to treat himself to a joint of meat on a Sunday, considers it
as an event in the week. So, in the old Cambridge comedy of the
Returne from Parnassus, we find this indignant description of the
progress of luxury in those days, put into the mouth of one of the
speakers.
‘Why is ‘t not strange to see a ragged clerke,
Some stammell weaver, or some butcher’s sonne,
That scrubb’d a late within a sleeveless gowne,
When the commencement, like a morrice dance,
Hath put a bell or two about his legges,
Created him a sweet cleane gentleman:
How then he ‘gins to follow fashions.
He whose thin sire dwelt in a smokye roofe,
Must take tobacco, and must wear a locke.
His thirsty dad drinkes in a wooden bowle,
But his sweet self is served in silver plate.
His hungry sire will scrape you twenty legges
For one good Christmas meal on new year’s day,
But his mawe must be capon cramm’d each day.’
Act III. Scene 2.
This does not look as if in those days ‘it snowed of meat and drink’
as a matter of course throughout the year!—The distinctions of dress,
the badges of different professions, the very signs of the shops, which
we have set aside for written inscriptions over the doors, were, as Mr.
Lamb observes, a sort of visible language to the imagination, and
hints for thought. Like the costume of different foreign nations, they
had an immediate striking and picturesque effect, giving scope to the
fancy. The surface of society was embossed with hieroglyphics, and
poetry existed ‘in act and complement extern.’ The poetry of former
times might be directly taken from real life, as our poetry is taken
from the poetry of former times. Finally, the face of nature, which
was the same glorious object then that it is now, was open to them;
and coming first, they gathered her fairest flowers to live for ever in
their verse:—the movements of the human heart were not hid from
them, for they had the same passions as we, only less disguised, and
less subject to controul. Deckar has given an admirable description
of a mad-house in one of his plays. But it might be perhaps objected,
that it was only a literal account taken from Bedlam at that time: and
it might be answered, that the old poets took the same method of
describing the passions and fancies of men whom they met at large,
which forms the point of communion between us: for the title of the
old play, ‘A Mad World, my Masters,’ is hardly yet obsolete; and we
are pretty much the same Bedlam still, perhaps a little better
managed, like the real one, and with more care and humanity shewn
to the patients!
Lastly, to conclude this account; what gave a unity and common
direction to all these causes, was the natural genius of the country,
which was strong in these writers in proportion to their strength. We
are a nation of islanders, and we cannot help it; nor mend ourselves
if we would. We are something in ourselves, nothing when we try to
ape others. Music and painting are not our forte: for what we have
done in that way has been little, and that borrowed from others with
great difficulty. But we may boast of our poets and philosophers.
That’s something. We have had strong heads and sound hearts
among us. Thrown on one side of the world, and left to bustle for
ourselves, we have fought out many a battle for truth and freedom.
That is our natural style; and it were to be wished we had in no
instance departed from it. Our situation has given us a certain cast of
thought and character; and our liberty has enabled us to make the
most of it. We are of a stiff clay, not moulded into every fashion, with
stubborn joints not easily bent. We are slow to think, and therefore
impressions do not work upon us till they act in masses. We are not
forward to express our feelings, and therefore they do not come from
us till they force their way in the most impetuous eloquence. Our
language is, as it were, to begin anew, and we make use of the most
singular and boldest combinations to explain ourselves. Our wit
comes from us, ‘like birdlime, brains and all.’ We pay too little
attention to form and method, leave our works in an unfinished
state, but still the materials we work in are solid and of nature’s
mint; we do not deal in counterfeits. We both under and over-do, but
we keep an eye to the prominent features, the main chance. We are
more for weight than show; care only about what interests ourselves,
instead of trying to impose upon others by plausible appearances,
and are obstinate and intractable in not conforming to common
rules, by which many arrive at their ends with half the real waste of
thought and trouble. We neglect all but the principal object, gather
our force to make a great blow, bring it down, and relapse into
sluggishness and indifference again. Materiam superabat opus,
cannot be said of us. We may be accused of grossness, but not of
flimsiness; of extravagance, but not of affectation; of want of art and
refinement, but not of a want of truth and nature. Our literature, in a
word, is Gothic and grotesque; unequal and irregular; not cast in a
previous mould, nor of one uniform texture, but of great weight in
the whole, and of incomparable value in the best parts. It aims at an
excess of beauty or power, hits or misses, and is either very good
indeed, or absolutely good for nothing. This character applies in
particular to our literature in the age of Elizabeth, which is its best
period, before the introduction of a rage for French rules and French
models; for whatever may be the value of our own original style of
composition, there can be neither offence nor presumption in saying,
that it is at least better than our second-hand imitations of others.
Our understanding (such as it is, and must remain to be good for any
thing) is not a thoroughfare for common places, smooth as the palm
of one’s hand, but full of knotty points and jutting excrescences,
rough, uneven, overgrown with brambles; and I like this aspect of the
mind (as some one said of the country), where nature keeps a good
deal of the soil in her own hands. Perhaps the genius of our poetry
has more of Pan than of Apollo; ‘but Pan is a God, Apollo is no more!’
LECTURE II
ON THE DRAMATIC WRITERS CONTEMPORARY WITH
SHAKESPEAR, LYLY, MARLOW, HEYWOOD, MIDDLETON, AND
ROWLEY
Yet how little he was borne out in this inference by the unbiassed
dictates of his own mind, may appear from the freedom and
unguarded boldness of such lines as the following, addressed by a
favourite to a prince, as courtly advice.
‘Know ye that lust of kingdoms hath no law:
The Gods do bear and well allow in kings
The things that they abhor in rascal routs.
When kings on slender quarrels run to wars,
And then in cruel and unkindly wise
Command thefts, rapes, murder of innocents,
The spoil of towns, ruins of mighty realms;
Think you such princes do suppose themselves
Subject to laws of kind and fear of Gods?
Murders and violent thefts in private men
Are heinous crimes, and full of foul reproach;
Yet none offence, but deck’d with noble name
Of glorious conquests in the hands of kings.’
The principal characters make as many invocations to the names
of their children, their country, and their friends, as Cicero in his
Orations, and all the topics insisted upon are open, direct, urged in
the face of day, with no more attention to time or place, to an enemy
who overhears, or an accomplice to whom they are addressed; in a
word, with no more dramatic insinuation or byeplay than the
pleadings in a court of law. Almost the only passage that I can
instance, as rising above this didactic tone of mediocrity into the
pathos of poetry, is one where Marcella laments the untimely death
of her lover, Ferrex.
‘Ah! noble prince, how oft have I beheld
Thee mounted on thy fierce and trampling steed,
Shining in armour bright before the tilt;
And with thy mistress’ sleeve tied on thy helm,
And charge thy staff to please thy lady’s eye,
That bowed the head-piece of thy friendly foe!
How oft in arms on horse to bend the mace,
How oft in arms on foot to break the sword,
Which never now these eyes may see again!’
testbankfan.com