Learn AI-Assisted Python Programming (MEAP V01) Leo Porterpdf download
Learn AI-Assisted Python Programming (MEAP V01) Leo Porterpdf download
https://ebookmeta.com/product/learn-ai-assisted-python-
programming-meap-v01-leo-porter/
https://ebookmeta.com/product/creating-intelligent-products-
meap-v01-generative-ai-advanced-analytics-smart-automation-leo-
porter/
https://ebookmeta.com/product/ai-assisted-testing-meap-v01-mark-
winteringham/
https://ebookmeta.com/product/data-storytelling-with-python-
altair-and-generative-ai-meap-v01-angelica-lo-duca/
https://ebookmeta.com/product/waste-problems-and-management-in-
developing-countries-1st-edition-umair-riaz-editor/
We Own This City Justin Fenton
https://ebookmeta.com/product/we-own-this-city-justin-fenton/
https://ebookmeta.com/product/mastering-in-house-seo-2nd-edition-
simon-schnieders/
https://ebookmeta.com/product/artificial-intelligence-and-
machine-learning-in-2d-3d-medical-image-processing-1st-edition-
rohit-raja-editor/
https://ebookmeta.com/product/harry-potter-and-the-deathly-
hallows-j-k-rowling/
https://ebookmeta.com/product/be-less-zombie-how-great-companies-
create-dynamic-innovation-fearless-leadership-and-passionate-
people-1st-edition-elvin-turner/
Cheeseman, Business Law, 10e -R2 - CLOSED 10th Edition
Henry R. Cheeseman [Cheeseman
https://ebookmeta.com/product/cheeseman-business-
law-10e-r2-closed-10th-edition-henry-r-cheeseman-cheeseman/
Learn AI-Assisted Python Programming
1. Copyright_2023_Manning_Publications
2. welcome
3. 1_Introducing_AI-Assisted_Programming_with_Copilot
4. 2_Getting_Started_with_Copilot
5. 3_Designing_Functions
6. 4_Reading_Python_Code_–_Part_1
MEAP Edition
Version 1
https://livebook.manning.com/#!/book/learn-ai-assisted-python-
programming/discussion
For more information on this and other Manning titles go to
manning.com
welcome
Thank you for purchasing the MEAP for Learn AI-Assisted Python
Programming.
We’re at the start of a new era in programming. AI coding assistants are here
—ChatGPT, Copilot, and others—and they’re transforming how people
program. The two of us have spent our careers researching and enhancing
student learning of programming. We have never been more excited about
the possibilities that AI coding assistants bring for the beginner or would-be
programmer.
In this book, we fully embrace these tools and use them to offer an alternative
way to learn how to write software. We believe that new learners of Python
shouldn’t be spending time learning low-level details that are now mostly
solved by the AI coding assistants. Instead, we believe that these tools
empower you to write larger and more powerful software faster.
This book is for those who are interested in learning how to write software
with Python or for the many people who tried and failed (we get it!) to learn
how to write Python code in the traditional way. No prior programming skills
are required, but we expect you to be comfortable with installing software
and managing files.
We’ve organized the book to get you started writing software with Copilot
right from the start. Then we teach you the essential skills that you need to
program with Copilot effectively: code reading, problem decomposition, and
testing. After that, we’ll bring all the skills together to write small software
projects in meaningful domains.
At the same time, we need to caution you: it’s early. These tools seem to be
changing on a daily basis. We don’t know what programming will look like
when the dust settles. The two of us are exploring new territory with few
established answers and we are excited to start this journey with you.
If you have any questions, comments, or suggestions, please share them in
Manning’s liveBook Discussion forum for our book.
In this book
In this chapter, we’ll talk about how humans communicate with computers.
We’ll introduce you to your AI Assistant, Copilot, an amazing tool that uses
Artificial Intelligence (AI) to help people write software. More importantly,
we’ll show you how Copilot can help you learn how to program. We’re not
expecting that you’ve written any programs before. If you have, please don’t
skip this chapter, even if you already know a little bit about programming.
Everyone needs to know why writing programs is different now that we have
AI assistants like ChatGPT and Copilot, and that the skills we need to be
effective programmers change. As we’ll see, we also need to be vigilant,
because sometimes tools like ChatGPT and Copilot lie.
section .text
global _start
_start:
mov ecx, 10
mov eax, '0'
l1:
mov [num], eax
mov eax, 4
mov ebx, 1
push ecx
mov ecx, num
mov edx, 1
int 0x80
mov eax, [num]
inc eax
pop ecx
loop l1
mov eax, 1
int 0x80
section .bss
num resb 1
That monstrosity prints out the numbers from 0 to 9. It's written using code in
assembly language, a low-level programming language. Low-level
programming languages, as you can see, are very far from languages that
humans can easily read and write. They’re designed for computers, not
humans.
No one wants to write programs like that. But, especially in the past, it was
sometimes necessary. Programmers could use it to do exactly what they
wanted the computer to do, down to individual instructions. This level of
control was needed in order to squeeze every bit of performance out of
underpowered computers. For example, the most speed-critical pieces of
1990s computer games such as Doom and Quake were written in assembly
language like the code above. It simply wouldn't have been possible to make
those games otherwise.
Okay, no more of that. Let's move on. Would you be happier with this?
for num in range(0, 9):
print(num)
This is changing.
Using an AI assistant, we can now ask for what we want in English and have
the computer code written for us in response. To get a correct Python
program that does actually print the numbers from 0 to 9, we can ask our AI
assistant (Copilot) in normal English language like this:
# Output the numbers from 0 to 9
Unlike the example we showed you before, this piece of Python code actually
works!
AI coding assistants can be used to help people write code. In this book, we
will learn how to use Copilot to write code for us. We will ask for what we
want in English, and we will get the code back in Python.
More than that, we'll be able to use Copilot as a seamless part of our
workflow. Without tools like Copilot, programmers routinely have two
windows open: the one where they write code and the other where they ask
on Google how to write code. This second window would have Google
search results, Python documentation, or forums of programmers talking
about how to write code to solve that particular problem. They're often
pasting code from these results into their code, then tweaking it slightly for
their context, trying alternatives, and so on. This has become a way of life for
programmers—but you can imagine the inefficiency here. By some estimates,
up to 35% of programmer’s time may be spent searching for code [1], and
much of the code that is found is not readily usable. This will be much
improved with Copilot helping us write our code.
There are other programming languages, too, like Java, C++, Rust, and many
others. Copilot works with those, too, but at the time of writing, it works
really well with Python. Python code is a lot easier to write compared to
many other languages (especially assembly code). Even more importantly,
Python is easy to read. After all, we’re not going to be the one writing the
Python code. Our AI assistant is!
Computers don’t actually know how to read and run Python code. The only
thing computers can understand is something called machine code, which
looks even more ridiculous than assembly code as it is the binary
representation of the assembly code (yep, just a bunch of 0s and 1s!). Behind
the scenes, your computer takes any Python code that you provide and
converts it into machine code before it runs, as shown in Figure 1.1.
Figure 1.1 Your Python program goes through several steps before you see the output on your
screen
Copilot, your AI Assistant
You can think of Copilot as a layer between you and the computer program
you’re writing. Instead of writing the Python directly, you simply describe
the program you want in words—this is called a prompt—and Copilot
generates the program for you.
Imagine that we asked you what the next word should be in this sentence:
"The person opened the ________". There are many words that you could fill
in here, like “door” or “box” or “conversation,” but there are also many
words that would not fit here, like “the” or “it” or “open.” An LLM takes into
account the current context of words to produce the next word, and it keeps
doing this until it has completed the task.
[22] 1700-luvun.
[23] "Liian myöhään viisastuvat frygialaiset." (Vanha sananparsi.)
*** END OF THE PROJECT GUTENBERG EBOOK IKUISEEN
RAUHAAN: VALTIO-OIKEUDELLINEN TUTKIELMA ***
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.