[FREE PDF sample] Problem Solving and Python Programming E. Balagurusamy ebooks
[FREE PDF sample] Problem Solving and Python Programming E. Balagurusamy ebooks
com
https://ebookmass.com/product/problem-solving-and-python-
programming-e-balagurusamy/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookmass.com/product/programming-for-problem-solving-e-
balagurusamy/
ebookmass.com
https://ebookmass.com/product/programming-and-problem-solving-with-
python-ashok-namdev-kamthane/
ebookmass.com
https://ebookmass.com/product/python-programming-using-problem-
solving-approach-1st-edition-reema-thareja/
ebookmass.com
https://ebookmass.com/product/computer-programming-e-balagurusamy/
ebookmass.com
Programming in C E. Balagurusamy
https://ebookmass.com/product/programming-in-c-e-balagurusamy/
ebookmass.com
https://ebookmass.com/product/introduction-to-computing-and-problem-
solving-using-python-1st-edition-e-balaguruswamy/
ebookmass.com
https://ebookmass.com/product/programming-in-ansi-c-6th-edition-e-
balagurusamy/
ebookmass.com
https://ebookmass.com/product/matlab-a-practical-introduction-to-
programming-and-problem-solving-4th-edition-stormy-attaway/
ebookmass.com
https://ebookmass.com/product/introduction-to-programming-with-java-a-
problem-solving-approach-3rd-edition-john-dean/
ebookmass.com
Problem Solving and
Python Programming
About the Author
E Balagurusamy is presently the Chairman of EBG Foundation, Coimbatore. In the past he has also held the
positions of member, Union Public Service Commission, New Delhi and Vice-Chancellor, Anna University,
Chennai, Tamil Nadu. He is a teacher, trainer and consultant in the fields of Information Technology and
Management. He holds an ME (Hons) in Electrical Engineering and PhD in Systems Engineering from the
Indian Institute of Technology, Roorkee, Uttarakhand. His areas of interest include Object-Oriented Software
Engineering, E-Governance: Technology Management, Business Process Re-engineering and Total Quality
Management.
A prolific writer, he has authored a large number of research papers and several books. His best-selling
books, among others include:
● Programming in ANSIC, 7/e
● Fundamentals of Computers
● Numerical Methods
● Reliability Engineering
E Balagurusamy
Chairman
EBG Foundation
Coimbatore
Copyright © 2018 by McGraw Hill Education (India) Private Limited. No part of this publication may be reproduced or distributed in
any form or by any means, electronic, mechanical, photocopying, recording, or otherwise or stored in a database or retrieval system
without the prior written permission of the publishers. The program listings (if any) may be entered, stored and executed in a computer
system, but they may not be reproduced for publication.
1 23456789 D101417 22 21 20 19 18
Printed and bound in India
Print Edition:
ISBN-13: 978-93-87067-01-1
ISBN-10: 93-87067-01-7
Information contained in this work has been obtained by McGraw Hill Education (India), from sources believed to be reliable. However,
neither McGraw Hill Education (India) nor its authors guarantee the accuracy or completeness of any information published herein,
and neither McGraw Hill Education (India) nor its authors shall be responsible for any errors, omissions, or damages arising out
of use of this information. This work is published with the understanding that McGraw Hill Education (India) and its authors are
supplying information but are not attempting to render engineering or other professional services. If such services are required, the
assistance of an appropriate professional should be sought.
Typeset at The Composers, 260, C.A. Apt., Paschim Vihar, New Delhi 110 063 and printed at
Cover Printer:
Preface ix
Unit 3: Functions
Developments in the field of digital electronics and the huge amount of data generated during the last
few decades ushered in the second Industrial Revolution which is popularly referred to as the Information
Revolution. Information technology played an ever-increasing role in this new revolution. A sound knowledge
of how computers work, process and analyze data has, therefore, become indispensable for everyone who
seeks employment not only in the area of IT, but also in any other fields. Rightly so, many institutions and
universities in India have introduced a subject covering Problem Solving and Python Programming for their
undergraduate students. This book caters to those needs of the undergraduate students.
Publisher’s Note
Remember to write to us. We look forward to receiving your feedback, comments, and ideas to enhance
the quality of this book. You can reach us at info.india@mheducation.com. Please mention the title and
authors’ name as the subject. In case you spot piracy of this book, please do let us know.
Unit 1
Introduction to Computing and
Algorithmic Problem Solving
1.1 IntroductIon
In earlier days, the term “digital computer” was used to refer a person who drew mathematical tables and
solved complex calculations. In less than a human lifetime, computers have changed from massive, expensive
and unreliable calculators to the dependable and versatile machines that are now omnipresent in society.
Computers were once the size of rooms and used to take a day to change the program and now, it is just a
double click away. Computers help the impossible become possible. They have become a necessary tool in
today’s society. Without computers, it is hard to do pretty much anything. Computers process information in
1’s and 0’s (usually referred to as On and Off respectively). This operation identifies instructions in Binary
Code. This is the language understood by the computer to complete a command. By 1953, it was estimated
that there were almost 100 computers in the world.
It is believed that the first computer was invented in Berlin, Germany, in 1936.
● The Z1 was invented in 1936 by Konrad Zuse in Germany. This was a programmable machine that
1944. It was a large calculator. This computer was able to calculate many different types of numbers.
● With the advancement of technology and research, major companies like IBM, Apple, and Intel have
contributed to the explosion of the personal computers as we know today. For example, Apple 1 was
released in 1976 which was having memory of 4 KB expandable to 8 KB. The Macintosh was released
in 1984 which was having memory of 64 KB expandable to 256 KB.
● CSIRAC was the first computer to play digital music in 1949.
● UNIVAC 1 was used by CBS to predict the results of the 1952 presidential elections in USA.
● COBOL (Common Business Oriented Language), one of the oldest programming languages, was
● Single - board computer known as apple -1 was designed by Steve Wozniak some more important
developments and was marketed by his friend Steve Jobs.
● In 1980 IBM introduced its Personal Computers (PC). The first IBM PC was known as IBM Model
window's NT
● In 1994 Sony entred the home gaming market with release of play station console.
A Personal Computer (PC) is a digital computer designed for the usage by one person at a time. PCs
can be classified into desktop computers, workstations and laptop computers. Today, PCs have five major
applications which are as follows:
1. Internet Browser: Internet browser is a software application used to access the Internet. For example,
Internet Explorer, Firefox, Opera, etc., are all Internet browsers.
2. Data Compression Software: Data compression software is used to reduce file size. ZIP is widely used
as the data compression software on personal computers.
3. Windows Media Player: Windows Media Player is used to create music libraries for listening music.
4. Image Editing Software: Image editing software is used to develop good quality pictures. Examples of
such software include Photoshop, Microsoft Publisher and Picasa.
5. Audio Editing Software: Audio editing software is used to edit audio files and also to add audio effects.
Note The first personal computer was Altair 8800. Later IBM introduced IBM PC.
Computers have become an integral part of the society because of the following characteristics they
possess:
● A computer can perform millions of calculations in a second.
● A computer can store billions of bytes of information. For example, the capacity of a terabyte =
2,00,000 songs.
● A computer can work continuously without getting tired.
execution. The information can be stored by using compact disk (CD), floppy, etc.
2. Data or programs are stored into the main memory.
3. Processing of instructions is sequential.
Note A process describes how the processor takes the data or program, decodes it and
finally executes it. The fetch-decode-execute cycle is also known as the Von Neumann
execution cycle.
The accomplishment of this matter is linked with the third and last
general division of our main subject, the question of administration.
As a natural consequence of events in American musical history,
dating from the earliest days, there has arisen the so-called 'musical
world' of America to-day, the well-defined national system of concert,
recital and operatic life. This system arose normally to supply the
new world with the products of the highly developed musical art of
the old, and in such a capacity it has admirably served its purpose.
In the course of time, however, and with the increasing wealth and
musical culture of America, the harvest to be reaped by the
commercial exploitation of foreign artists has not remained
unperceived by a country not naturally backward in the perception of
commercial advantage. It is quite natural that those who took into
their hands the management of these affairs should seek the
greatest profit which they could be made to yield. This, it will readily
be seen, was not to come from the broad development of a given
locality, which would involve education and a departure from the
centres of wealth, but from the exploitation of the narrow circle of
wealth and culture which existed in every community of importance.
Thus a great circuit was established throughout the country, by
which a process of skimming the cream from as many communities
as possible was set in operation, in the presentation of famous
foreign artists to what has been allowed to pass as the American
public. Thus a system established originally as a service to the
people has finally degenerated to the condition of a commercial
enterprise which is utterly without regard to the broader interests of
the people. The true condition of affairs is made evident to-day by
the fact that when a resident of any moderate-sized prosperous
American city starts to inaugurate some local musical enterprise for
the benefit of the whole community, and calling for the entire
community's support, he learns that the concert and recital life of his
city, its 'musical world,' reaches and is supported by but from three to
five per cent. of the entire population. The other ninety-five to ninety-
seven per cent. find the regular musical events beyond their means,
as well as beyond the facts of their culture, though in the latter
respect America is now rapidly learning that the enjoyment of the
best music is far less dependent upon special education than has
commonly been supposed.
With this question the nation has of late begun to deal in no half-
hearted or uncertain manner. In fact, the national response to this
situation involves the greatest American musical movement of the
day. In its earlier phase the question asked was: Will the people,
under democracy, rise to the accepted standards of musical culture?
A negative answer to this question has been generally entertained,
and among cultured people it has been commonly supposed that
democracy would drag down the standards of musical culture. That a
wholly new and multifold phase of musical life would arise to meet
the requirements of a civilization such as that of America seems to
have been earlier suspected or foreseen only by a few thinking
students of conditions, who recognized the fact that the exact
meeting of the mass, as it became more enlightened, with the
conditions of traditional musical culture was not the solution which
was to be expected or even desired. The plain fact was that the
people at large were not enjoying the benefits, the pleasure,
recreation, or inspiration, as the case might be, of all that the world
prizes as music in any of its forms above that of popular songs and
dances. Neither the educational system, on the one hand, nor the
cultural system, on the other, provided them with it. One merely gave
a little elementary training of the most primitive sort, and for a short
time, to children, and the other did not reach beyond the extremely
restricted sphere of culture and wealth. A movement was needed
which should bring music in all of its forms directly to the masses of
the people, and in the nation-wide campaign for what may be termed
'music for the people' such a movement has arisen. Experiments on
every hand have shown that the people have needed only to be
brought in contact with the higher forms of music, under
advantageous conditions, to rise spontaneously to the enjoyment of
it. The movement, in its activities, has assumed no particular form,
but has taken a variety of forms according to the possibilities of local
conditions. The 'Forest Festival,' or 'Midsummer High Jinks,' of the
Bohemian Club in San Francisco, while not open to the general
public, has nevertheless shown the potent appeal of outdoor musical
dramatic festivals to a large number of persons not commonly in
touch with musical life. Municipal concerts on a scale not hitherto
attempted, such as those in Central Park, New York, presenting not
band, but orchestral concerts of the world's greatest music, have met
with an astonishing and enthusiastic response on the part of the
masses who have hitherto had no opportunity of hearing anything
above the popular music of the streets, the dance halls, and the
'movies.' The musical phase of the social centre movement has
assumed vast and national proportions, making use of the public
school halls for concerts and recitals for thousands of persons who
were previously without musical opportunities. Certain towns, such
as Bethlehem, Pa., Lindsburg, Kans., and the towns of the 'Litchfield
County Choral Union,' Conn., have established choral enterprises
which include in the choruses practically the entire population. In two
years the custom of Christmas trees with music, free to the people,
has become almost a national movement. The 'community chorus,'
such as that established in Rochester, N. Y., with a membership of
nearly one thousand drawn from the people at large, and singing in
the public parks and school halls, should prove a desirable form of
people's musical enterprise in many places. Standard symphony
orchestras in various cities are branching out extensively in the
direction of giving concerts involving the highest order of music to
the people at popular prices, and in some cities the organization of
symphony orchestras for popular price concerts is threatening the
existence of the regular orchestra. And well-nigh surpassing in
significance most other phases of the general movement, and
certainly in their popular inclusiveness, are the pageants or
'community dramas' with music, which are now constituting a feature
of community life throughout the country.
If, then, the appreciative epoch along the older lines, is concluded in
America, it may be said that the nation is coming to a new
appreciation of music, as a whole, in its relation to humanity. The
new movement will call forth new and larger efforts on the part of
American composers, who, with their present thorough assimilation
of the various musical influences of the world, will lead the nation
into a new and mature creative epoch.
Arthur Farwell.
August, 1914.
CONTENTS OF VOLUME FOUR
PAGE
Part I. Appreciation
CHAPTER
I
A consideration of music among the Indians is not germane to our
present purpose. As far as we are concerned Indian music is an
exotic, and it is only of recent years that American composers have
turned to it in a conscious search for national color which is,
perhaps, the first real symptom of aspiration toward characteristically
national expression. From the point of view of musical history the
development of American music must be considered as beginning
among the first white settlers on these shores, and it may be said at
once that those beginnings, like Guy of Warwick's death, are still
'wrop in mystery.' Regarding musical life in the colonies before the
year 1700 our information is so slight as to be negligible. For almost
a century preceding that year white men—many of them men of
culture—had been settled in America.[2] That these men completely
forgot the art in which so many of them found pleasure, and in which
at least a few of them must have possessed some skill, is a
supposition too absurd to be seriously entertained. As to the nature
and proportions of their musical activities we have no exact evidence
and, in default of such, it is necessary for us to dip a little into
comparative history.
Nor was this noteworthy musical activity confined to the small class
of professional musicians. If we may believe Morley,[4] and read
aright the references of Shakespeare and other contemporary
writers, music was sedulously practised by all classes in England,
from the sovereign to the beggar. Queen Elizabeth, we find, played
excellently on the virginals and the poliphant, though it does not
appear that her dour successor took very kindly to such exercises. It
seems to have been a matter of course that every well-reared girl
should sing at sight and play acceptably on the virginals, the flute,
and the cittern. Sight-reading—alas for our degenerate days—was
apparently a universal accomplishment, at least among people of the
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookmass.com