(eBook PDF) Introduction to Programming Using Python An 1 - Quickly download the ebook in PDF format for unlimited reading
(eBook PDF) Introduction to Programming Using Python An 1 - Quickly download the ebook in PDF format for unlimited reading
com
https://ebookluna.com/product/ebook-pdf-introduction-to-
programming-using-python-an-1/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookluna.com/product/python-programming-an-introduction-to-
computer-science-3rd-edition-by-john-zelle-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-introduction-to-programming-
using-visual-basic-10th-edition/
ebookluna.com
https://ebookluna.com/download/an-introduction-to-parallel-
programming-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-7th-edition/
ebookluna.com
(eBook PDF) Java: An Introduction to Problem Solving and
Programming 8th Edition
https://ebookluna.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-8th-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-python-programming-in-
context-3rd-edition/
ebookluna.com
https://ebookluna.com/product/python-programming-in-context-3rd-
edition-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-microsoft-visual-c-an-
introduction-to-object-oriented-programming-7th-edition/
ebookluna.com
https://ebookluna.com/download/problem-solving-and-python-programming-
ebook-pdf/
ebookluna.com
Contents
Preface xi
Acknowledgments xv
Programming Projects 74
Appendices
Appendix A ASCII Values 349
Appendix B Reserved Words 351
Appendix C Installing Python and IDLE 353
Answers 355
Index 405
This page intentionally left blank
Preface
S ince its introduction in the 1990s, Python has become one of the most widely used
programming languages in the software industry. Also, students learning their first
programming language find Python the ideal tool to understand the development of
computer programs.
My objectives when writing this text were as follows:
1. To develop focused chapters. Rather than covering many topics superficially,
I concentrate on important subjects and cover them thoroughly.
2. To use examples and exercises with which students can relate, appreciate, and feel
comfortable. I frequently use real data. Examples do not have so many embel-
lishments that students are distracted from the programming techniques
illustrated.
3. To produce compactly written text that students will find both readable and informa-
tive. The main points of each topic are discussed first and then the peripheral
details are presented as comments.
4. To teach good programming practices that are in step with modern programming
methodology. Problem-solving techniques, structured programming, and
object-oriented programming are thoroughly discussed.
5. To provide insights into the major applications of computers.
xi
xii ◆ Preface
or are best appreciated after the student has thought about them. The reader should
seriously attempt the practice problems and study their solutions before moving on
to the exercises.
Comments. Extensions and fine points of new topics are deferred to the “Comments”
portion at the end of each section so that they will not interfere with the flow of the
presentation.
Key Terms and Concepts. In Chapters 2 through 8, the key terms and concepts (along
with examples) are summarized at the end of the chapter.
Guide to Application Topics. This section provides an index of programs that deal
with various topics including Business, Economics, Mathematics, and Sports.
VideoNotes. Twenty-four VideoNotes are available at www.pearsonhighered.com/
schneider. VideoNotes are Pearson’s visual tool designed for teaching key program-
ming concepts and techniques. VideoNote icons are placed in the margin of the text
book to notify the reader when a topic is discussed in a video. Also, a Guide to Video
Notes summarizing the different videos throughout the text is included.
Solution Manuals. The Student Solutions Manual contains the answer to every odd-
numbered exercise (not including programming projects). The Instructor Solutions
Manual contains the answer to every exercise and programming project. Both solu-
tion manuals are in pdf format and can be downloaded from the Publisher’s website.
Source Code and Data Files. The programs for all examples and the data files needed
for the exercises can be downloaded from the Publisher’s website.
Instructor Resources
The following protected instructor resource materials are available on the Publisher’s
website at www.pearsonhighered.com/schneider. For username and password infor-
mation, please contact your local Pearson representative.
Preface ◆ xiii
Student Resources
Access to the Premium website and VideoNotes tutorials is located at www
.pearsonhighered.com/schneider. Students must use the access card located in the
front of the book to register and access the online material. If there is no access
card in the front of this textbook, students can purchase access by going to www
.pearsonhighered.com/schneider and selecting “purchase access to premium con-
tent.” Instructors must register on the site to access the material.
The following content is available through the Premium website:
• VideoNotes
• Student Solutions Manual
• Programs for examples (Data files needed for the exercises are included in the
Programs folder.)
This page intentionally left blank
Acknowledgments
xv
Visit https://testbankfan.com
now to explore a rich
collection of testbank or
solution manual and enjoy
exciting offers!
This page intentionally left blank
1
An Introduction to
Computing and Problem
Solving
1.1 An Introduction to Computing and Python 2
1
2 ◆ Chapter 1 An Introduction to Computing and Problem Solving
Question: Why did you decide to use Python as the programming language?
Answer: Many people consider Python to be the best language to teach beginners how to
program. We agree. Also, Python is being used by major software companies. Python is
powerful, easy to write and read, easy to download and install, and it runs under Windows,
Mac, and Linux operating systems.
Question: This book uses the editor IDLE to create programs. How did IDLE get its name?
Answer: Idle stands for Integrated DeveLopment Environment. (Some people think the
name was chosen as a tribute to Eric Idle, a founding member of the Monty Python group.)
The IDLE editor has many features (such as color coding and formatting assistance) that
help the programmer.
Question: What are the meanings of the terms “programmer” and “user”?
Answer: A programmer (also called a developer) is a person who solves problems by writing
programs on a computer. After analyzing the problem and developing a plan for solving it,
the programmer writes and tests the program that instructs the computer how to carry out
the plan. The program might be run many times, either by the programmer or by others.
A user is any person who runs the program. While working through this text, you will
function both as a programmer and as a user.
1.1 An Introduction to Computing and Python ◆ 3
Question: Are there certain characteristics that all programs have in common?
Answer: Most programs do three things: take in data, manipulate data, and produce results.
These operations are referred to as input, processing, and output. The input data might be
held in the program, reside on a disk, or be provided by the user in response to requests
made by the computer while the program is running. The processing of the input data
occurs inside the computer and can take from a fraction of a second to many hours. The
output data are displayed on a monitor, printed on a printer, or recorded on a disk. As a
simple example, consider a program that computes sales tax. An item of input data is the
cost of the thing purchased. The processing consists of multiplying the cost by the sales
tax rate. The output data is the resulting product, the amount of sales tax to be paid.
Question: What are the meanings of the terms “hardware” and “software”?
Answer: Hardware refers to the physical components of the computer, including all periph-
erals, the central processing unit (CPU), disk drives, and all mechanical and electrical
devices. Programs are referred to as software.
Question: Many programming languages, including Python, use a zero-based numbering system.
What is a zero-based numbering system?
Answer: In a zero-based numbering system, numbering begins with zero instead of one. For
example, in the word “code”, “c” would be the zeroth letter, “o” would be the first letter,
and so on.
presses the Enter (or return) key, the names of the presidents who have that first name are
displayed.
Question: How can the programs for the examples in this textbook be obtained?
Answer: See the preface for information on how to download the programs from the
Pearson website.
is used to process the distance traveled and the time elapsed in order to determine the
speed. That is,
Random documents with unrelated
content Scribd suggests to you:
The Project Gutenberg eBook of Bastiljin
valloitus
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Language: Finnish
BASTILJIN VALLOITUS
Kirj.
Alexandre Dumas
Ranskankielestä suomentanut
Jalmari Finne
Sillä välin kun nämä pelaavat koululaiset, joille torin varrella asuvat
naapurit olivat antaneet heittiöiden arvonimen, ja joiden vaatteiden
polvet olivat kuluneet ja takkien kyynärpäissä oli reikiä, pysähtyivät
torille, sillaikaa ne oppilaat, joita kiitettiin siivoiksi ja jotka akkojen
puheitten mukaan olivat vanhempainsa ilo ja ylpeys, erottautuivat
suuresta joukosta ja astelivat vasu kainalossa niin hitaasti, että
arvasi heidän kaihomielin jättävän toisten leikit, kotiaan kohden,
missä heitä odotti leivos tai namu palkaksi siitä, että he olivat
luopuneet torille jääneiden iloista. Näiden takit oli melkein ehjät ja
heidän housunsa tavallisesti moitteettomassa asussa, mikä seikka
yhdessä heidän siivoutensa kanssa herätti pilkanhalua jopa vihaakin
huonommin puetuissa ja kasvatetuissa koulutovereissa.
"Sattui sillä tavoin tänään, herra apotti, tunnustan sen kyllä, mutta
torstai on aina onnettomuuspäiväni. Jos huomenna kirjoitukseni olisi
hyvä, niin ettekö antaisi anteeksi tämänpäiväistä huonoa onneani?
Ettekö antaisi, herra apotti?"
"Ja kukapa tietää, ehkä tutkijat eivät olekaan minun suhteeni sen
ankarampia kuin rintaveljeni Sebastien Gilbertin suhteen kun hän
viime vuonna kilpaili Pariisin opintorahasta. Hän se vasta tekikin
kielivirheitä. Luojan kiitos, vaikka oli vasta kolmentoista vanha ja
minä olen jo seitsemäntoista."
"Nyt et ole yhtä typerä kuin äsken", mutisi hän oltuaan hetken
vaiti ja tarkasteltuaan poikaa… "Mutta tämä on vain todenmukaista
eikä todistettua. Species, non autem corpus."
"Mitäkö muuta?"
"Arkadia oli seutu, missä oli paljon aaseja, ja muinaisaikoina
merkitsi asinus samaa kuin stultus."
"En ole tahtonut selittää asioita sillä tavalla", vastasi Pitou, "sillä en
voinut uskoa, että arvoisan opettajani vakava mieli alistuisi ivaan."
Pitou oli niin masentunut, ettei osannut paeta, vaikka apotti veti
patukan vyöstänsä yhtä arvokkaasti kuin sotapäällikkö paljastaisi
miekan huotrasta taistelun alkaessa.
"Olkoon siis niin!" sanoi Pitou kuin mies, joka tekee tuskallisen
päätöksen, mutta tekee sen kuitenkin. "Saanko viedä mukanani
pulpettini?" kysyi hän toivoen, että sinä väliaikana apotin sydän
ennättäisi lauhtua hellemmäksi.
Kun hänellä oli pitkät käsivarret ja vahvat polvet, joiden avulla hän
jaksoi kiivetä paksuimpiakin runkoja myöten, kapusi hän
korkeimpiinkin puihin etsimään linnunpesiä niin nokkelasti ja
varmasti, että toverit häntä ihailivat, ja jos hän olisi asunut
lähempänä päiväntasaajaa, niin apinat olisivat häntä kunnioittaneet
sen taidon vuoksi, jonka hän oli saavuttanut erikoisessa
linnunmetsästyksessä, joka aikuisiakin suuresti miellyttää. Metsästäjä
houkuttelee linnut ansoilla varustettuun puuhun ja matkii äänellä
närhiä tai huuhkajaa, joita muu lintumaailma yleensä kovasti vihaa.
Jokainen rastas, tiainen, sirkku lentää kiiruimman kautta
nokkiakseen höyhenen vihollisestaan ja useimmissa tapauksissa
paneekin oman henkensä vaaraan. Pitoun toverit käyttivät oikeata
huuhkajaa tai närhiä tai erikoista pilliä, jonka avulla voivat
mitenkuten matkia näiden lintujen ääntä. Mutta Pitou halveksi näitä
keinoja ja tällaisia valmisteluja. Hän turvautui omiin keinoihinsa ja
viritti ansan käyttäen luonnonlahjojaan. Suullaan hän matki noita
huutoja, joiden avulla hän houkutteli toiset linnut, jopa samaan
lajiinkin kuuluvat, ne kun pettyivät kuullessaan nämä huudot, sillä ne
olivat siksi hyvin matkittuja.
Mutta kun tämä kunnon nainen sairastui, kun hän tunsi kuoleman
saapuvan, kun hän käsitti jättävänsä lapsensa yksinään maailmaan,
silloin hän alkoi epäillä ja rupesi etsimään tukea vastaiselle orvolle.
Hän muisti silloin, että kymmenen vuotta aikaisemmin oli muuan
nuori mies keskellä yötä kolkuttanut hänen ovelleen sylissään
vastasyntynyt lapsi, jonka hoitamista varten hän jätti jokseenkin
suuren rahamäärän, ja toinen vieläkin suurempi oli uskottu Villers-
Cotteretsissa asuvan asianajajan huostaan. Tästä salaperäisestä
nuoresta miehestä hän ei alussa tiennyt mitään nimitä kuin että
hänen nimensä oli Gilbert. Mutta kolme vuotta sitten hän näki tämän
saman miehen uudelleen ilmestyvän. Silloin hän oli noin
kahdenkymmenenseitsemän vuoden vanha mies, jonka käytös oli
jäykkä, sanat tarkoin punnitut ja esiintyminen alussa hiukan
kylmäkiskoista. Mutta tämä päällimmäinen jääkuori katosi, kun hän
näki lapsensa, sai nähdä hänet kauniina, terveenä ja hymyilevänä,
kasvatettuna hänen tahtonsa mukaan luonnon keskellä. Silloin hän
puristi kunnon naisen kättä ja sanoi hänelle vain:
Pitoun äiti tiesi kaikki nämä seikat. Kuoleman hetkellä hän muisti
nämä sanat: "Hädän tullen turvautukaa minuun" Heti hänen
ajatuksensa kirkastuivat. Ehkä sallimus oli tämän kaiken näin
järjestänyt, jotta pikku Pitou löytäisi enemmän kuin mitä hän kadotti.
Hän kutsutti luoksensa papin, koska hän ei itse osannut kirjoittaa.
Pappi kirjoitti, ja samana päivänä kirje vietiin apotti Fortierille, joka
liitti siihen osoitteen ja joudutti sen postiin.
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.
ebookluna.com