Python for Teenagers: Learn to Program like a Superhero! 2 Ed

Python for Teenagers: Learn to Program like a Superhero! 2 Ed

Python for Teenagers: Learn to Program like a Superhero! 2 Ed

Автор: James R. Payne
Дата выхода: 2024
Издательство: Apress Media, LLC.
Количество страниц: 329
Размер файла: 6,2 МБ
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы

About the Author
About the Technical Reviewer
Acknowledgments
Introduction
Chapter 1: Introduction to Computer Programming and Python
Programming Language Overview
Python Overview
How Does Python Differ from Other Programming Languages?
The Benefits of Python
Examples of Python in the Wild
Your First Python Program
Installing Python
Installing Python on Windows
Installing Python on Other Operating Systems
In This Episode!
Chapter 2: It All Adds Up
Operator Precedence
Data Types: Know Your Enemy
Converting Number Data Types
What Are Variables?
Superhero Generator 3000
In This Episode!
Chapter 3: Stringing Things Along
Leave Your Comments at the Door
Block Commenting
Inline Commenting
Other Uses for Commenting
Texting – Without Your Phone
Working with Strings and Variables
Longer Strings
Strings on Multiple Lines
Formatting Strings
Introducing a New Weapon to Your Arsenal: Lists
Changing Lists
Other List Methods
In This Episode!
Chapter 4: Making Decisions
Making Decisions
Conditional Statements
Behold – The If Statement!
Boolean Logic and Comparison Operators
Else Statements
Else-If Statements
Logical Operators
Nesting – Not Just for the Birds
In This Episode!
Chapter 5: Loops and Logic
What Are Loops?
Limiting Loops
For Loops
More Fun with For Loops
Break, Continue, and Pass Statements
In This Episode!
Chapter 6: Using What We’ve Learned
Creating Your First Real Program
Importing Modules
Creating Our Variables
Defining Our Lists
Introductory Text and Accepting Input from the User
Creating Suspense!
Randomizing Superhero Names
A Quick Check-In
Randomizing the Superpowers
Finishing Our Program
The SuperheroGenerator3000 Code – Completed!
Chapter 7: Saving Time with  Functions, Modules, and Built-Ins
Defining Modules
Built-Ins
Packages
Creating Your Own Module
Common Built-In Functions
String Functions
Number Functions
Practice Your New Functions
String Function Examples
Number Function Examples
In This Episode!
Chapter 8: Using Classes and Objects
What Is OOP?
What Are Classes (And Will I Be Graded?)
What Are Objects
Creating Our First Class
Creating Our First Object
Improving the Superhero Generator 3000!
Inheritance, Subclasses, and More!
Adding the Bells and Whistles
The New and Improved Superhero Generator 3000 Code!
In This Episode!
Chapter 9: Introducing Other Data Structures
More Data Structures
What Are Tuples?
The Tuple Functions
More Fun with Tuples
Tuple Examples
Working with Dictionaries
Dictionary Methods
More Fun with Dictionaries
Other Dictionary Methods
Example Dictionary Code
In This Episode!
Chapter 10: Python Files
Working with Files in Python
File Types
Creating a Text File in Python Code
Reading Files in Python
Using readline( ) and readlines( )
A Warning About Reading and Writing to Files
Appending to Files
Working with Directories
Bonus Round!
FunWithFiles.py Code
WorkingWithDirectories.py
In This Episode!
Chapter 11: Python for Gaming
Python for Gaming
Types of Games You Can Code in Python
Pygame Introduction
Installing Pygame
Setting Up the Pygame Bare Bones for a Game
Adding to Our Game Skeleton
Adding Images and Sprites in Pygame
Adding Text to Our Pygame Game Window
Drawing Shapes in Pygame
Adding More Events
In This Episode
Chapter 12: Animating Games
Creating Animations in Pygame
Collision Detection: Bouncing Off the Walls
Collision Detection: Detecting the Window Boundaries
Colliding Two Objects
In This Episode!
Chapter 13: Error Handling
Finding Errors
Types of Errors
Syntax Errors
Logical Errors
Exceptions
The Try Except Else Block
Using Finally
Creating Custom Exceptions
Logging
Debugging Tools in Python
One Final Tip for Handling Errors
In This Episode!
Chapter 14: Python Career
Working with Python
Career Paths for Python
Beta Tester
Code Debugger/Bug Locator
Data Scientists
Software Developer/Software Engineer
Video Game Programmer
Mobile Development
Web Development and Web Applications
System Administration
Research, Teaching, and More
Common Python Interview Questions
Can You Tell Me Some of the Key Features of Python?
What Is the Difference Between a Tuple and a List
What Is Inheritance?
How Do You Generate Random Values in Python?
How Do You Create a List, Tuple, and Dictionary in Python?
What Is the Difference Between a Local Variable and a Global Variable?
What Are the Different Data Types Python Offers?
What Is a GUI? What Python Library Is Best for GUI Development?
How Do You Open a File in Python?
How Would You List the Functions of a Module?
Other Python Interview Questions
Best Programming Practices
Follow Style Guides
If It’s Broken, Fix It (Now, Not Later)
Documentation Is Everything
Use Code Repositories and Packages
Test Often
Choose a Side: Indentation or Spaces
Classes Are Great, But Not Everything Needs to Be One
The Future of Python
Python Terms
Index

 This book, which is designed for middle-school through college-aged students, will arm beginners with solid programming foundations they can carry throughout life. It uses fun and simple language (and programming examples) to teach the fundamentals needed to start the down path of becoming a programmer. Python is a highly flexible language, allowing developers to enter any number of technical fields and is a welcome addition to any resume. With its low learning curve, it makes a great introductory language, as new developers can take the coding fundamentals they learn in Python and apply them to any other language. 

 The second edition builds upon the foundation of the first book, revising all the chapters where the language has changed, updating the commands, code, and examples to bring it up to date with the current version of Python.

 Since Python is the most popular programming language in the world and can be used in conjunctionwith other languages - across multiple platforms - it can increase the reader's ability to qualify for a wider range of jobs than other languages. Finally, Python is fun - something not every programming language can boast!

What You Will Learn

  • Install and configure Python
  • Grasp basic software development principles and syntax
  • Understand the best practices for coding in Python
  • Create applications and debug code

Who This Book Is For

 The book’s target audience is primarily middle school to college aged students looking to learn how to program computers and develop software. Older individuals and computer programmers who know other languages and want to add Python to their repertoire can also benefit from the book.


Похожее: