• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 407 pages
Exam (elaborations)

Python Programming: An Introduction to Computer Science 2nd Edition By John M. Zelle

Document preview thumbnail
Preview 4 out of 407 pages

Python Programming: An Introduction to Computer Science 2nd Edition By John M. Zelle

Content preview

Sp Sp Sp Sp Sp
la la la la l as l as
sh sh sh sh h h
ne ne ne ne ne ne
tz tz tz tz tz t
2nd Edition By John M.



An Introduction to
Computer Science


Sp Sp Sp Sp Sp
An Introduction To Compter Science




la la la la l as
sh sh sh sh h
n e ne ne ne ne

,Sp Sp Sp Sp Sp Sp
la l
a la la la la
sh sh sh sh sh sh
ne ne ne ne ne ne
tz tz tz tz tz
lOMoAR cPSD| 24448587




Sp Sp Sp SpSp
la la la la la
sh sh sh sh sh
ne ne ne ne ne

, lOMoAR cPSD| 24448587




ne
sh




ne
la

tz




sh
Sp

ne




la
Python Programming:
sh




Sp
An Introduction to Computer Science




ne
la

tz
John M. Zelle, Ph.D.




sh
Sp

ne
Preliminary Second Edition
Fall 2009




la
Copyright © 2009 John M Zelle.
sh




Sp

ne
la

tz

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or




sh
transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise,
Sp




without prior written permission.
ne




la
sh




Sp

ne
This document was typeset by the author with LATEX 2ë.
la




Contents
tz




sh
Sp

ne




1 Computers and Programs 1
la
1.1 The Universal Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
sh




1.2 Program Power ....................................... 2
Sp

ne
1.3 What is Computer Science? ................................ 3
a




1.4 Hardware Basics ...................................... 4
tz
l




sh
Sp




1.5 Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
ne




1.6 The Magic of Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
la
sh




Sp
la
Sp

, lOMoAR cPSD| 24448587




ne
sh




ne
la

tz




sh
Sp

ne




la
1.7 Inside a Python Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
sh




Sp
1.8 Chaos and Computers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14




ne
1.9 Chapter Summary ..................................... 16
la

tz
1.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17




sh
Sp


2 Writing Simple Programs 21
ne

2.1 The Software Development Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21




la
2.2 Example Program: Temperature Converter . . . . . . . . . . . . . . . . . . . . . . . . 22
sh




Sp
2.3 Elements of Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24




ne
2.3.1 Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
la

tz

2.3.2 Expressions ..................................... 25




sh
Sp




2.4 Output Statements ..................................... 27
ne



2.5 Assignment Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28




la
2.5.1 Simple Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
sh




Sp
2.5.2 Assigning Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30




ne
2.5.3 Simultaneous Assignment ............................. 32
la

tz




2.6 Definite Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 sh
Sp




2.7 Example Program: Future Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
ne




2.8 Chapter Summary ..................................... 39
la
2.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
sh




Sp

3 Computing with Numbers 45
ne
3.1 Numeric Data Types .................................... 45
a
tz
l




3.2 Using the Math Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
sh
Sp




3.3 Accumulating Results: Factorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
ne




la


i
sh




Sp
la
Sp

Document information

Uploaded on
June 13, 2025
Number of pages
407
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
CA$41.01

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
GoldStar
4.7
(270)
Sold
316
Followers
14
Items
1003
Last sold
1 week ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions