Skip to content

Commit e84aaa2

Browse files
committed
Add stuff
1 parent ebe6d25 commit e84aaa2

File tree

7 files changed

+240
-33
lines changed

7 files changed

+240
-33
lines changed

1.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
# 1. Installing Python and using it as a calculator
1+
# Installing Python and using it as a calculator
22

33
### Installing Python
44

5-
Make sure you have read my [introduction to this tutorial](README.md).
5+
Make sure you have read my [introduction to this tutorial](introduction.md).
66

7-
The first thing you need to do with Python is to launch it. In this tutorial we're going to use IDLE to get started. More experienced Python users will go on and on about how IDLE sucks, but Python comes with it so we might as well use it.
7+
The first thing you need to do with Python is to launch it. In this
8+
tutorial we're going to use IDLE to get started. More experienced Python
9+
users will go on and on about how IDLE sucks, but Python comes with it
10+
so we might as well use it.
811

912
On Windows, download the latest version of Python 3 from [python.org](https://www.python.org/downloads/). On GNU/Linux, **do not download Python**. You likely have Python 3 installed already and all you need is IDLE. If you're on a Debian based GNU/Linux distribution (such as Ubuntu or Linux Mint) you can use aptitude to install IDLE. Simply open a terminal from a menu, type this command to it and press Enter:
1013

LICENSE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
This is a slightly modified version of the MIT license.
2+
You can read the original license here:
3+
4+
https://opensource.org/licenses/MIT
5+
6+
7+
8+
Copyright (c) 2016 Akuli
9+
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this tutorial and associated code examples (the “Tutorial”), to
12+
deal in the Tutorial without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Tutorial, and to permit persons to whom the
15+
Tutorial is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Tutorial.
19+
20+
THE TUTORIAL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26+
TUTORIAL OR THE USE OR OTHER DEALINGS IN THE TUTORIAL.

README.md

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
# Python programming tutorial
22

3-
[Python](https://en.wikipedia.org/wiki/Python_\(programming_language\)) is a high-level, interactive and object-oriented programming language. Its simple syntax makes it a great choice for a first programming language for a beginner.
4-
5-
No tutorial is good for everyone. This one is aimed at people with very little programming experience or no programming experience at all. If you have programmed a lot in the past using some other language you probably want to read [the official tutorial](https://docs.python.org/3/tutorial/) instead. Like most other tutorials, this tutorial starts with math, and you can skip that if you hate math.
6-
7-
This tutorial uses Python 3. Python 2 is not under active development anymore, and more and more projects are moving to Python 3. There are a few packages that don't support Python 3 that well at the time of writing this (such as twisted), but you don't need to worry about that.
8-
9-
This tutorial includes lots of footnotes _[*]_. They are for people who want to know more about something in more detail and for people who would otherwise complain about how my tutorial is wrong about some things. There's often links to awesome resources such as tutorials and videos. If you've finished reading my tutorial and doing the exercises I recommend reading the footnotes and other places they point to.
10-
11-
_[*] Footnotes are like this._
12-
13-
To learn as much as possible from this tutorial, I recommend following these steps for all code examples in this tutorial. However, it's OK to skip these if you fully understand the example.
14-
15-
- Read the example and try it out yourself.
16-
- If you don't fully understand why the example works like it does, read the explanation for it. Of course, you can read it anyway :)
17-
- Modify the example to do something else than it does.
18-
19-
Most importantly, when learning a programming language you need to **experiment fearlessly and try new things that you did not read from a tutorial**. It's almost impossible to break your computer accidentally with Python. 99% of the time typing something wrong will simply make an error message that tells you what's wrong, it will not destroy anything.
20-
21-
Here's a list of chapters in this tutorial:
22-
23-
1. [Installing Python and using it as a calculator](1.md)
24-
2. [Strings, variables, Booleans and None](2.md)
25-
3. [Using functions and storing code in files](3.md)
26-
4. [If, elif, else and while](4.md)
27-
28-
This tutorial is not officially licensed yet, but **you are free to read, download and distribute it with or without modifications if you include this notice with your copy**. If you have a suggestion for license or other suggestions, please help us improve this tutorial by [making an issue](https://github.com/Akuli/python-tutorial/issues/new) about your suggestion.
3+
[Python](https://en.wikipedia.org/wiki/Python_\(programming_language\))
4+
is a high-level, interactive and object-oriented programming language.
5+
Its simple syntax makes it easy to learn and fast to work with, so it's
6+
a great choice for a first programming language.
7+
8+
No tutorial is good for everyone. This one is aimed at people with no
9+
programming experience at all or very little programming experience. If
10+
you have programmed a lot in the past using some other language you
11+
probably want to read
12+
[the official tutorial](https://docs.python.org/3/tutorial/) instead.
13+
14+
This tutorial uses Python 3. Python 2 is not under active development
15+
anymore, and more and more projects are moving to Python 3. There are a
16+
few popular libraries that don't support Python 3 that well at the time
17+
of writing this, but you don't need to worry about that just yet. They
18+
will probably support Python 3 when you've learned the basics and you
19+
need them.
20+
21+
Here's a list of chapters in this tutorial. Read them one by one in the
22+
order they are listed, unless you already know some things.
23+
24+
1. [Quick introduction to this tutorial](introduction.md)
25+
2. [Installing Python](installing-python.md)
26+
3. [Installing Python and using it as a calculator](1.md)
27+
4. [Strings, variables, Booleans and None](2.md)
28+
5. [Using functions and storing code in files](3.md)
29+
6. [If, elif, else and while](4.md)
2930

3031
I'm Akuli and I have written most of this tutorial, but the following people have helped me with it:
31-
- [SpiritualForest](https://github.com/SpiritualForest): Lots of typing error fixes.
32+
- [SpiritualForest](https://github.com/SpiritualForest): Lots of typing
33+
error fixes.
3234
- [theelous3](https://github.com/theelous3): Small improvements and fixes.
35+
36+
***
37+
38+
You may use this tutorial at your own risk. See [LICENSE](LICENSE).

TODO.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

contact-me.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Contact me
2+
3+
If you have any trouble with the tutorial or you would like to improve
4+
it, there are a few ways to contact me:
5+
6+
- Create an issue on GitHub.
7+
8+
This is probably the best choice if you had trouble following the
9+
tutorial, and something in it should be explained better. Click
10+
[here](https://github.com/Akuli/python-tutorial/issues/new) to
11+
create an issue. You will be asked to create a GitHub account if you
12+
don't already have one.
13+
14+
- Tell me on IRC.
15+
16+
I'm usually on
17+
[##learnpython on freenode](https://kiwiirc.com/client/chat.freenode.net/##learnpython).
18+
You don't need to register anywhere, just click the link and you're
19+
good to go. If there's no Akuli in the user list, try again after a
20+
few hours. Maybe we are not on the same time zone.
21+
22+
If you need to post a code example that is more than two lines long,
23+
post it [here](http://dpaste.com/) first. Just copy-paste your code
24+
to the big text area and click the "Paste it" button. Then post a
25+
link to your paste on IRC.
26+
27+
***
28+
29+
You may use this tutorial freely at your own risk. See [LICENSE](LICENSE).
30+
31+
[Back to the list of contents](README.md)

installing-python.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Installing Python
2+
3+
If you want to learn to program with Python using this tutorial, you
4+
need to try out the code examples. You could use a website like
5+
[repl.it](https://repl.it/languages/python3), but I highly recommend
6+
installing Python. That way you don't need to open a web browser just to
7+
write code, and you can work without an Internet connection.
8+
9+
Let's get started!
10+
11+
### Downloading and installing Python
12+
13+
#### Windows
14+
15+
1. Go to [the official Python website](https://www.python.org/).
16+
2. Move your mouse over the blue Downloads button, but don't click it,
17+
Then click the button that downloads the latest version of Python.
18+
3. Run the installer.
19+
4. Select the "advanced installation" option, and make sure the py.exe
20+
launcher gets installed.
21+
22+
#### Mac OSX
23+
24+
I don't have an up-to-date copy of Mac OSX. If you would like to write
25+
instructions for OSX, [tell me](contact-me.md).
26+
27+
#### GNU/Linux
28+
29+
You already have Python, there's no need to install it. If you
30+
31+
If you want to use IDLE (see below), install it. The name of the package
32+
is `idle3` on Debian-based distributions, like Ubuntu and Linux Mint,
33+
and you can install it with a software manager like any other program.
34+
On other distributions you can just search for idle using the
35+
distribution's package manager.
36+
37+
### Running Python
38+
39+
Now you have Python installed. There are several ways to run Python:
40+
41+
1. Directly from PowerShell, command prompt or terminal.
42+
2. Using IDLE.
43+
3. Using something else.
44+
45+
I'm not going to focus on the third option in this tutorial, but if you
46+
know how to use Python with something else than PowerShell, command
47+
prompt, a terminal or IDLE it's fine. Do whatever you want.
48+
49+
#### If you like working with PowerShell, command prompt or terminal
50+
51+
On Windows. you should be able to run Python from a PowerShell window,
52+
or a command prompt window if you don't have PowerShell. Open one of
53+
these programs from the start menu or start screen, type there `py` and
54+
press Enter. You should see something like this in it:
55+
56+
C:\Users\You> py
57+
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18)
58+
[MSC v.1600 32 bit (Intel)] on win32
59+
Type "help", "copyright", "credits" or "license" for more information.
60+
>>>
61+
62+
On GNU/Linux or Mac OSX, type `python3` instead:
63+
64+
you@YourComputer:~$ python3
65+
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
66+
[GCC 4.8.4] on linux
67+
Type "help", "copyright", "credits" or "license" for more information.
68+
>>>
69+
70+
Now type `exit()` and press Enter to get out of Python.
71+
72+
#### If you are not an advanced user and you have no idea what PowerShell, command prompt and terminal are
73+
74+
Use IDLE. Experienced Python users will say that IDLE is garbage, but
75+
don't listen to them. These people want you to use "better" alternatives
76+
with more features, but that's exactly what you don't want as a
77+
beginner. You should spend as little time as possible learning your
78+
tools, and as much time as possible learning Python. Advanced
79+
programming tools are not going to help you at all with this.
80+
81+
Launch Python's IDLE like any other program. You should see something
82+
like this:
83+
84+
![IDLE](idle.png)
85+
86+
From now on, I'll instead show everything like this, so I don't have to
87+
take more screenshots:
88+
89+
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
90+
[GCC 4.8.4] on linux
91+
Type "copyright", "credits" or "license()" for more information.
92+
>>>
93+
94+
The exact content of your Python's welcome message is probably different
95+
than mine, it's ok.
96+
97+
### Summary
98+
- Now you should be able run Python.
99+
-
100+
101+
***
102+
103+
You may use this tutorial freely at your own risk. See [LICENSE](LICENSE).
104+
105+
[Back to the list of contents](README.md)

introduction.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Quick introduction to this tutorial
2+
3+
I started writing a full Python tutorial, but I stopped when I realized
4+
that it would be a lot of work. Instead, I'm currently combining it with
5+
links to other free tutorials, so some day it should be all you need to
6+
get started with Python.
7+
8+
Everything in this tutorial contains a lot of examples, and the tutorial
9+
should be easy to follow. But what should you do if you don't understand
10+
something the first time you read it?
11+
12+
1. Read the example code and the explanation for it again.
13+
2. Try the example yourself.
14+
3. If you still don't understand, please [tell me](contact-me.md). I want
15+
to improve the tutorial so other readers won't have the same problem
16+
as you did.
17+
18+
One of the most important things with learning to program is to
19+
**not fear mistakes**. If you make a mistake, your computer will not
20+
break in any way. You'll get an error message that tells you what's
21+
wrong and where. Even professional programmers do mistakes and get error
22+
messages all the time, and there's nothing wrong with it.
23+
24+
Even though a good tutorial is an important part about learning to
25+
program, you also need to learn to make your own things. Use what you
26+
have learned, and create something with it.
27+
28+
### Summary
29+
30+
- Now you should know what to do if you don't understand something.
31+
- Don't fear mistakes.
32+
- Error messages are your friends.
33+
- Don't be limited to this tutorial, also make your own programs.
34+
35+
***
36+
37+
You may use this tutorial freely at your own risk. See [LICENSE](LICENSE).
38+
39+
[Back to the list of contents](README.md)

0 commit comments

Comments
 (0)