没有合适的资源?快使用搜索试试~ 我知道了~
Python 《Full Speed Python》-快速入门Python1
需积分: 0 0 下载量 60 浏览量
2022-08-03
14:05:02
上传
评论
收藏 990KB PDF 举报
温馨提示
试读
39页
1. Download the latest Python 3 release for Windows on https://www.python.org/ 2
资源详情
资源评论
资源推荐
Full Speed Python
João Ventura
Contents
1 Introduction 3
2 Installation 4
Installing on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Installing on macOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Installing on Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Numbers and strings 8
Exercises with numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Exercises with strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 Lists 11
Exercises with lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
List comprehensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Exercises with list comprehensions . . . . . . . . . . . . . . . . . . . . . . . . 12
5 Modules and functions 14
Exercises with the math module . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Exercises with functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Recursive functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Exercises with recursive functions . . . . . . . . . . . . . . . . . . . . . . . . . 16
6 Iteration and loops 17
Exercises with the for loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Exercises with the while statement . . . . . . . . . . . . . . . . . . . . . . . . 19
7 Dictionaries 21
Exercises with dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Exercises with sub-dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8 Classes 24
Exercises with classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Class inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Exercises with inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
9 Iterators 27
Iterator classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Exercises with iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1
10 Generators 30
Exercises with generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
11 Coroutines 32
Exercises with coroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Pipelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Exercises with coroutine pipelines . . . . . . . . . . . . . . . . . . . . . . . . . 35
12 Asynchronous programming 36
Exercises with asyncio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2
Chapter 1
Introduction
This book aims to teach the Python programming language using a practical approach.
Its method is quite simple: after a short introduction to each topic, the reader is invited
to learn more by solving the proposed exercises.
These exercises have been used extensively in my web development and distributed
computing classes at the Superior School of Technology of Setúbal. With these exercises,
most students are up to speed with Python in less than a month. In fact, students of
the distributed computing course, taught in the second year of the software engineering
degree, become familiar with Python’s syntax in two weeks and are able to implement a
distributed client-server application with sockets in the third week.
Please note that this book is a work in progress and, as such, may contain a few spelling
errors that may be corrected in the future. However it is made available now as it is so it
can be useful to anyone who wants to use it. I sincerely hope you can get something good
through it.
The source of this book is available on github (https://github.com/joaoventura/full-speed-
python). I welcome any pull requests to correct misspellings, suggest new exercises or to
provide clarification of the current content.
All the best,
João Ventura - Adjunct Professor at the Escola Superior de Tecnologia de Setúbal.
3
Chapter 2
Installation
In this chapter we will install and run the Python interpreter in your local computer.
Installing on Windows
1.
Download the latest Python 3 release for Windows on https://www.python.org/
downloads/windows/ and execute the installer. At the time of writing, this is Python
3.6.4.
2.
Make sure that the “Install launcher for all users” and “Add Python to PATH”
settings are selected and choose “Customize installation”.
Figure 2.1: Windows installation
3.
In the next screen “Optional Features”, you can install everything, but it is essential
to install “pip” and “pylauncher (for all users)”. Pip is the Python package manager
that allows you to install several Python packages and libraries.
4.
In the Advanced Options, make sure that you select “Add Python to environment
variables”. Also, I suggest that you change the install location to something like
4
剩余38页未读,继续阅读
王佛伟
- 粉丝: 17
- 资源: 320
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0