100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Class notes

starting out with phyton

Rating
-
Sold
-
Pages
886
Uploaded on
07-03-2023
Written in
2021/2022

this is a lecture note of science computure (starting out with phyton)

Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Unknown
Course

Document information

Uploaded on
March 7, 2023
Number of pages
886
Written in
2021/2022
Type
Class notes
Professor(s)
Tony gaddis
Contains
All classes

Subjects

Content preview

, Contents in a Glance

Preface   xiii
Chapter 1 Introduction to Computers and Programming 1
Chapter 2 Input, Processing, and Output 31
Chapter 3 Decision Structures and Boolean Logic 119
Chapter 4 Repetition Structures 169
Chapter 5 Functions 219
Chapter 6 Files and Exceptions 303
Chapter 7 Lists and Tuples 361
Chapter 8 More About Strings 431
Chapter 9 Dictionaries and Sets 467
Chapter 10 Classes and Object-Oriented Programming 521
Chapter 11 Inheritance 583
Chapter 12 Recursion 609
Chapter 13 GUI Programming 629
Chapter 14 Database Programming 717
Appendix A Installing Python 799
Appendix B Introduction to IDLE 803
Appendix C The ASCII Character Set 811
Appendix D Predefined Named Colors 813
Appendix E More About the import Statement 819
Appendix F Formatting Numeric Output with the format() Function 823
Appendix G Installing Modules with the pip Utility 829
Appendix H Answers to Checkpoints 831
Index 853
Credits 869 v




A01_GADD9032_05_SE_FM.indd 5 11/12/19 2:31 PM

, Contents

Preface    xiii

Chapter 1 Introduction to Computers and Programming 1
1.1 Introduction 1
1.2 Hardware and Software 2
1.3 How Computers Store Data 7
1.4 How a Program Works 12
1.5 Using Python 20
Review Questions 24

Chapter 2 Input, Processing, and Output 31
2.1 Designing a Program 31
2.2 Input, Processing, and Output 35
2.3 Displaying Output with the print Function 36
2.4 Comments 39
2.5 Variables 40
2.6 Reading Input from the Keyboard 49
2.7 Performing Calculations 53
2.8 String Concatenation 65
2.9 More About the print Function 67
2.10 Displaying Formatted Output with F-strings 70
2.11 Named Constants 80
2.12 Introduction to Turtle Graphics 81
Review Questions 109
Programming Exercises 114

Chapter 3 Decision Structures and Boolean Logic 119
3.1 The if Statement 119
3.2 The if-else Statement 128
3.3 Comparing Strings 131
3.4 Nested Decision Structures and the if-elif-else Statement 135
3.5 Logical Operators 143
3.6 Boolean Variables 149
3.7 Turtle Graphics: Determining the State of the Turtle 150
Review Questions 158
Programming Exercises 161

vii




A01_GADD9032_05_SE_FM.indd 7 11/12/19 2:31 PM

, viii Contents

Chapter 4 Repetition Structures 169
4.1 Introduction to Repetition Structures 169
4.2 The while Loop: A Condition-Controlled Loop 170
4.3 The for Loop: A Count-Controlled Loop 178
4.4 Calculating a Running Total 189
4.5 Sentinels 192
4.6 Input Validation Loops 195
4.7 Nested Loops 200
4.8 Turtle Graphics: Using Loops to Draw Designs 207
Review Questions 211
Programming Exercises 213

Chapter 5 Functions 219
5.1 Introduction to Functions 219
5.2 Defining and Calling a Void Function 222
5.3 Designing a Program to Use Functions 227
5.4 Local Variables 233
5.5 Passing Arguments to Functions 236
5.6 Global Variables and Global Constants 246
5.7 Introduction to Value-Returning Functions:
Generating Random Numbers 250
5.8 Writing Your Own Value-Returning Functions 261
5.9 The math Module 274
5.10 Storing Functions in Modules 277
5.11 Turtle Graphics: Modularizing Code with Functions 283
Review Questions 289
Programming Exercises 294

Chapter 6 Files and Exceptions 303
6.1 Introduction to File Input and Output 303
6.2 Using Loops to Process Files 321
6.3 Processing Records 328
6.4 Exceptions 341
Review Questions 354
Programming Exercises 358

Chapter 7 Lists and Tuples 361
7.1 Sequences 361
7.2 Introduction to Lists 361
7.3 List Slicing 370
7.4 Finding Items in Lists with the in Operator 373
7.5 List Methods and Useful Built-in Functions 375
7.6 Copying Lists 382
7.7 Processing Lists 383
7.8 List Comprehensions 397
7.9 Two-Dimensional Lists 399
7.10 Tuples 404
7.11 Plotting List Data with the matplotlib Package 406
Review Questions 423
Programming Exercises 426




A01_GADD9032_05_SE_FM.indd 8 11/12/19 2:31 PM
$7.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
kevinfrient

Get to know the seller

Seller avatar
kevinfrient All
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

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

Frequently asked questions