100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
starting out with phyton $7.49   Add to cart

Class notes

starting out with phyton

 3 views  0 purchase
  • Course
  • Institution

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

Preview 4 out of 886  pages

  • March 7, 2023
  • 886
  • 2021/2022
  • Class notes
  • Tony gaddis
  • All classes
  • Unknown
avatar-seller
, 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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller kevinfrient. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $7.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

83100 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$7.49
  • (0)
  Add to cart