Learn AI-assisted Python Programming: With GitHub Copilot and ChatGPT
معرفی کتاب «Learn AI-assisted Python Programming: With GitHub Copilot and ChatGPT» نوشتهٔ Leo Porter, Daniel Zingaro,Leo Porter,Daniel Zingaro، منتشرشده توسط نشر Manning Publications Co. LLC در سال 2023. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Learn AI-assisted Python Programming: With GitHub Copilot and ChatGPT» در دستهٔ بدون دستهبندی قرار دارد.
Writing computer programs in Python just got a lot easier! Use AI-assisted coding tools like GitHub Copilot and ChatGPT to turn your ideas into applications faster than ever. AI has changed the way we write computer programs. With tools like Copilot and ChatGPT, you can describe what you want in plain English, and watch your AI assistant generate the code right before your eyes. It’s perfect for beginners, or anyone who’s struggled with the steep learning curve of traditional programming. In Learn AI-Assisted Python Programming: With GitHub Copilot and ChatGPT you’ll learn how to: • Write fun and useful Python applications—no programming experience required! • Use the Copilot AI coding assistant to create Python programs • Write prompts that tell Copilot exactly what to do • Read Python code and understand what it does • Test your programs to make sure they work the way you want them to • Fix code with prompt engineering or human tweaks • Apply Python creatively to help out on the job Learn AI-Assisted Python Programming: With GitHub Copilot and ChatGPT is a hands-on beginner’s guide that is written by two esteemed computer science university professors. It teaches you everything you need to start programming Python in an AI-first world. You’ll hit the ground running, writing prompts that tell your AI-assistant exactly what you want your programs to do. Along the way, you’ll pick up the essentials of Python programming and practice the higher-level thinking you’ll need to create working apps for data analysis, automating tedious tasks, and even video games. Foreword by Beth Simon, Ph.D. About the technology The way people write computer programs has changed forever. Using GitHub Copilot, you describe in plain English what you want your program to do, and the AI generates it instantly. About the book This book shows you how to create and improve Python programs using AI—even if you’ve never written a line of computer code before. Spend less time on the slow, low-level programming details and instead learn how an AI assistant can bring your ideas to life immediately. As you go, you’ll even learn enough of the Python language to understand and improve what your AI assistant creates. What's inside • Prompts for working code • Tweak code manually and with AI help • AI-test your programs • Let AI handle tedious details About the reader If you can move files around on your computer and install new programs, you can learn to write useful software! About the author Dr. Leo Porter is a Teaching Professor at UC San Diego. Dr. Daniel Zingaro is an Associate Teaching Professor at the University of Toronto. The technical editor on this book was Peter Morgan. Learn AI-Assisted Python Programming 1 dedication 5 contents 6 foreword 11 acknowledgments 13 introduction 15 AI assistants change how programming is done 16 Audience 17 What we expect from you 17 What you will be able to do after reading this book 18 The challenge in working with AI assistants 18 Why we wrote this book 19 Warning: beware of elitism 19 How this book is organized: a roadmap 20 Source code downloads 22 Software/hardware requirements 22 liveBook discussion forum 22 about the authors 24 about the cover illustration 26 1 Introducing AI-assisted programming with Copilot 27 How we talk to computers 28 Making it a little easier 28 Making it a lot easier 29 About the technology 29 Copilot, your AI Assistant 31 How Copilot works behind the scenes—in 30 seconds 31 How Copilot changes how we learn to program 32 What else can Copilot do for us? 33 Risks and challenges when using Copilot 34 The skills we need 36 Societal concerns about AI code assistants like Copilot 37 Summary 38 2 Getting started with Copilot 39 Time to set up your computer to start learning 40 Overview of the software in your programming environment 40 Getting your system set up 41 Working with Copilot in Visual Studio Code 42 Set up your working folder 43 Check to see if your setup is working properly 44 Addressing common Copilot challenges 46 Our first programming problem 48 Showcasing Copilot’s value in a data processing task 49 Summary 58 3 Designing functions 59 Functions 60 The components of a function 61 Using a function 63 Benefits of functions 64 Roles of functions 66 What’s a reasonable task for a function? 69 Attributes of good functions 69 Examples of good (and bad) leaf functions 70 The cycle of design of functions with Copilot 71 Examples of creating good functions with Copilot 72 Dan’s stock pick 73 Leo’s password 76 Getting a strong password 80 Scrabble scoring 81 The best word 83 Summary 85 4 Reading Python code: Part 1 86 Why we need to read code 87 Asking Copilot to explain code 89 Top 10 programming features you need to know: Part 1 92 #1. Functions 93 #2. Variables 93 #3. Conditionals 95 #4. Strings 98 #5. Lists 100 Conclusion 102 Summary 102 5 Reading Python code: Part 2 104 Top 10 programming features you need to know: Part 2 105 #6. Loops 105 #7. Indentation 109 #8. Dictionaries 115 #9. Files 117 #10. Modules 120 Summary 124 6 Testing and prompt engineering 125 Why it is crucial to test code 126 Closed-box and open-box testing 126 Closed-box testing 127 How do we know which test cases to use? 129 Open-box testing 129 How to test your code 130 Testing using the Python prompt 130 Testing in your Python file (we won’t be doing it this way) 131 doctest 131 Revisiting the cycle of designing functions with Copilot 134 Full testing example 136 Finding the most students we can add to a row 136 Improving the prompt to find a better solution 139 Testing the new solution 140 Another full testing example—Testing with files 142 What tests should we run? 143 Creating the function 146 Testing the function 146 Common challenges with doctest 147 Summary 149 7 Problem decomposition 150 Problem decomposition 151 Small examples of top-down design 151 Authorship identification 153 Authorship identification using top-down design 155 Breaking down the process subproblem 155 Figuring out the signature for the mystery book 156 Summary of our top-down design 164 Implementing our functions 164 clean_word 165 average_word_length 166 different_to_total 168 exactly_once_to_total 168 split_string 170 get_sentences 172 average_sentence_length 172 get_phrases 173 average_sentence_complexity 173 make_signature 174 get_all_signatures 175 get_score 178 lowest_score 179 process_data 179 make_guess 180 Going further 182 Summary 183 8 Debugging and better understanding your code 184 What causes errors (bugs)? 185 How to find the bug 185 Using print statements to learn about the code behavior 186 Using VS Code’s debugger to learn about the code behavior 188 How to fix a bug (once found) 195 Asking Copilot to fix your bug via chat 195 Giving Copilot a new prompt for the whole function 197 Giving Copilot a targeted prompt for part of a function 197 Modifying the code to fix the bug yourself 198 Modifying our workflow in light of our new skills 199 Applying our debugging skills to a new problem 200 Using the debugger to better understand code 206 A caution about debugging 206 Summary 207 9 Automating tedious tasks 208 Why programmers make tools 209 How to use Copilot to write tools 209 Example 1: Cleaning up email text 210 Conversing with Copilot 211 Writing the tool to clean up email 215 Example 2: Adding cover pages to PDF files 218 Conversing with Copilot 220 Writing the tool 224 Example 3: Merging phone picture libraries 232 Conversing with Copilot 234 Top-down design 237 Writing the tool 238 Summary 241 10 Making some games 242 Game programs 243 Adding randomness 244 Example 1: Bulls and Cows 246 How the game works 246 Top-down design 248 Parameters and return types 250 Implementing our functions 252 Adding a graphical interface for Bulls and Cows 259 Example 2: Bogart 260 How the game works 260 Top-down design 262 Implementing our functions 266 Summary 273 11 Future directions 274 Prompt patterns 274 Flipped interaction pattern 276 Persona pattern 279 Limitations and future directions 281 Where Copilot (currently) struggles 281 Is Copilot a new programming language? 282 Summary 286 references 287 index 290 Writing computer programs in Python just got a lot easier! Use AI-assisted coding tools like GitHub Copilot and ChatGPT to turn your ideas into applications faster than ever. AI has changed the way we write computer programs. With tools like Copilot and ChatGPT, you can describe what you want in plain English, and watch your AI assistant generate the code right before your eyes. Its perfect for beginners, or anyone whos struggled with the steep learning curve of traditional programming. In Learn AI-Assisted Python With GitHub Copilot and ChatGPT youll learn how Learn AI-Assisted Python With GitHub Copilot and ChatGPT is a hands-on beginners guide that is written by two esteemed computer science university professors. It teaches you everything you need to start programming Python in an AI-first world. Youll hit the ground running, writing prompts that tell your AI-assistant exactly what you want your programs to do. Along the way, youll pick up the essentials of Python programming and practice the higher-level thinking youll need to create working apps for data analysis, automating tedious tasks, and even video games. Foreword by Beth Simon, Ph.D. Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications. About the technology The way people write computer programs has changed forever. Using GitHub Copilot, you describe in plain English what you want your program to do, and the AI generates it instantly. About the book This book shows you how to create and improve Python programs using AIeven if youve never written a line of computer code before. Spend less time on the slow, low-level programming details and instead learn how an AI assistant can bring your ideas to life immediately. As you go, youll even learn enough of the Python language to understand and improve what your AI assistant creates. What's inside About the Author If you can move files around on your computer and install new programs, you can learn to write useful software! About the author Dr. Leo Porter is a Teaching Professor at UC San Diego. Dr. Daniel Zingaro is an Associate Teaching Professor at the University of Toronto. The technical editor on this book was Peter Morgan. Table of Contents 1 Introducing AI-assisted programming with Copilot 2 Getting started with Copilot 3 Designing functions 4 Reading Python code Part 1 5 Reading Python Code Part 2 6 Testing and prompt engineering 7 Problem decomposition 8 Debugging and better understanding your code 9 Automating tedious tasks 10 Making some games 11 Future directions
دانلود کتاب Learn AI-assisted Python Programming: With GitHub Copilot and ChatGPT