Table of Contents
Introduction 1 About This Book 1
Foolish Assumptions 2
Icons Used in This Book 3
Beyond the Book 3
Part 1: Coding Basics 5
Chapter 1: What Is Coding? 7
Programming: Making a Computer Do Your Bidding 8
What Is a Programming Language? 9
The Role of Programming Languages 10
Understanding How Code Is Written and Executed 12
Why Learn to Code? Let Me Count the Ways 15
Real-World Uses of Coding 19
Chapter 2: Coding Concepts You Need to Know 23
Storing Stuff in Variables 24
Dealing with Data Types 27
Constructing Expressions 29
Making Decisions with Conditionals 33
Automating Repetitive Tasks with Loops 36
Organizing Code into Functions 38
Introducing Objects 41
Documenting Code with Comments 43
Debugging Code and Handling Errors 44
Chapter 3: Getting to Know Some Programming Languages 49
Ranking Programming Languages 50
Assembly: Close to the Machine 50
Python: No Experience Required 53
JavaScript: The Glue that Binds the Web 55
Sneaking a Peek at a Few Other Popular Languages 57
Grokking the Difference between Interpreted and Compiled Languages 68
Part 2: Learning Python: The Beginner-friendly Language 69
Chapter 4: Getting Started with Python 71
Getting to the Command Line 72
Installing Python 75
Running the Python Interpreter 80
Running Your First Python Program 84
Chapter 5: Getting Comfy with Some Python Fundamentals 89
Declaring Variables 90
Exploring Python Data Types 91
Constructing Expressions 93
Messing Around with Strings 97
Chapter 6: Storing Data and Controlling Your Code. 105
Storing Stuff in Lists 105
More Ways to Store Stuff: Tuples and Dictionaries 111
Conditionals in Python 115
Python Loops 119
Adding Comments to Your Code 123
Example: Build Your Own Survey Bot 123
Chapter 7: Reusing Code 127
Making Your Code More Efficient with Functions 128
Getting the Hang of Variable Scope 131
Avoiding Wheel Reinvention with Modules 134
Reuse Heaven: Installing External Libraries 141
Reusing Data by Writing and Reading Files 144
Example: Building a Quotations Archive 147
Chapter 8: Expanding Your Python Skills 153
Waxing Pythonic 154
Comprehending List Comprehensions 155
Introducing Object-Oriented Programming (OOP) 158
Working with APIs 165
Handling Program Errors 170
Debugging Your Code 174
Example: Cat Fact Cards 176
Chapter 9: Building Some Useful Python Projects 179
Project 1: Anagram Guessing Game 180
Project 2: Text Analyzer 193
Part 3: LEARNING JavaScript: THE LANGUAGE Of the Web 207
Chapter 10: Getting Your Feet Wet with JavaScript. 209
JavaScript: Controlling the Machine 210
What You Need to Get Started 211
Basic Script Construction 211
Adding Comments to Your Code 212
Creating External JavaScript Files 213
Getting to Know the Console 214
Chapter 11: Getting the Hang of a Few JavaScript Fundamentals 219
I Do Declare: Variables in JavaScript 220
Code Looping in JavaScript 221
Harnessing the Power of Functions 224
Getting the Hang of Variable Scope 227
Chapter 12: Tackling Some JavaScript Objects 231
Pulling Strings 231
Dealing with Dates and Times 236
Working with Numbers: The Math Object 240
Working with Arrays 244
Chapter 13: Unleashing JavaScript in the Browser 251
Getting to Know the Document Object Model 252
Specifying Elements 253
Traversing the DOM 257
Manipulating Elements 260
Modifying CSS with JavaScript 264
Building Reactive Pages with Events 267
Chapter 14: Debugging JavaScript 271
Examining Your Debugging Tools 272
Debugging with the Console Window 273
Pausing Your Code 275
Stepping Through Your Code 279
Chapter 15: Putting JavaScript to Work 283
Project 1: A Photo Gallery 284
Project 2: Get a Random Quotation from an API 286
Part 4: the Part of Tens 293
Chapter 16: Ten Things to Know about AI and Coding 295
Understanding How You Can Use AI 296
Learning What AI Can and Can’t Do 296
Crafting Effective Prompts 297
Learning to Code Using AI 298
Avoiding AI Dependency 298
Reviewing the Major AI Coding Tools 299
Vibe Coding Is Fun 300
Best Practices for Integrating AI 300
Avoiding Common Mistakes 301
Understanding Code Before Using It 301
Chapter 17: Ten Vital HTML Tags and CSS Properties 303
Ten HTML Tags You Need to Know 304
Ten CSS Properties to Memorize 306
Ten CSS Selectors to Swoon Over 308
Index 313