Little fixes · pythonkid2/python-tutorial@f5c9b09 · GitHub
Skip to content

Commit f5c9b09

Browse files
committed
Little fixes
1 parent 9db8ee7 commit f5c9b09

8 files changed

Lines changed: 60 additions & 34 deletions

‎answers.md‎

Lines changed: 27 additions & 7 deletions

‎classes.md‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This tutorial assumes that you know how functions work and how to
99
create your own functions with the `def` keyword. If you don't, I
1010
highly recommend learning that first, and then moving to classes.
1111

12-
### Why should I use custom classes in my projects?
12+
## Why should I use custom classes in my projects?
1313

1414
Python comes with a lot of classes that you are already familiar with.
1515

@@ -61,7 +61,7 @@ Python comes with. Instead you can define a Website class, and make
6161
Websites and process information about websites directly. Defining your
6262
own object types like this is called **object-orientated programming**.
6363

64-
### First class
64+
## First class
6565

6666
In Python, `pass` does nothing.
6767

@@ -160,7 +160,7 @@ handy way to see which attributes the instance contains.
160160
>>>
161161
```
162162

163-
### Class attributes
163+
## Class attributes
164164

165165
What happens if we set an attribute of the `Website` class to some value
166166
instead of doing that to an instance?
@@ -205,7 +205,7 @@ access class attributes through instances also, so in this case
205205
confusing, which is why it's not recommended to use class attributes like
206206
this. Use instance attributes instead, e.g. `stackoverflow.is_online = True`.
207207

208-
### Functions and methods
208+
## Functions and methods
209209

210210
Let's define a function that prints information about a website.
211211

@@ -276,7 +276,7 @@ In other words, `Class.method(instance)` does the same thing as
276276
`instance.method()`. This also works with built-in classes, for
277277
example `'hello'.lower()` is same as `str.lower('hello')`.
278278

279-
### Defining methods when defining the class
279+
## Defining methods when defining the class
280280

281281
Maybe we could define a method when we make the class instead of adding
282282
it later?
@@ -362,7 +362,7 @@ Free to use: True
362362
Classes have many other magic methods too, but I'm not going to cover
363363
them in this tutorial.
364364

365-
### When should I use classes?
365+
## When should I use classes?
366366

367367
Don't do this:
368368

@@ -393,7 +393,7 @@ word = input("Enter something: ")
393393
print("You entered " + word + ".")
394394
```
395395

396-
### Important things
396+
## Important things
397397

398398
Here are some of the most important things covered in this tutorial.
399399
Make sure you understand them.
@@ -413,3 +413,9 @@ Make sure you understand them.
413413
- `__init__` is a special method, and it's ran when a new instance of a
414414
class is created. It does nothing by default.
415415
- Don't use classes if your code is easier to read without them.
416+
417+
***
418+
419+
You may use this tutorial freely at your own risk. See [LICENSE](LICENSE).
420+
421+
[Back to the list of contents](README.md)

‎editor-setup.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ you want to indent**. Your editor should give you four spaces when you
2020
hit the tab key. Your editor should also remove four spaces when you
2121
hit backspace and there are four spaces before the cursor.
2222

23-
#### Geany
23+
### Geany
2424

2525
1. Create a file called `hello.py`, and open it in geany. Or create a
2626
file in geany and save it as `hello.py`.
@@ -36,7 +36,7 @@ color than the rest of your text. `"Strings"`, `# comments` and
3636
everything else should also have their own colors. This makes it much
3737
easier to write code.
3838

39-
#### Geany
39+
### Geany
4040

4141
Geany has syntax highlighting by default. You can also install more
4242
[color schemes](https://www.geany.org/Download/Extras#colors) if you
@@ -47,7 +47,7 @@ View, then Change Color Scheme.
4747

4848
Advanced editors support plugins. You may find some of them useful.
4949

50-
#### Geany
50+
### Geany
5151

5252
On Debian-based GNU/Linux distributions, install the geany-plugins
5353
package. See [the Geany website](https://plugins.geany.org/) for

‎getting-help.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
When you have a problem with Python, you're not alone! There are many
44
places to ask for help in.
55

6-
### IRC
6+
## IRC
77

88
IRC is the oldest chatting service I know, but as of 2016, it's still
99
in use, and a great way to get help in Python. You don't need to
@@ -34,12 +34,12 @@ Do this:
3434
Don't do this:
3535

3636
<you> HEEEEELP MEEEEEEEEEEEEEEE!!!
37-
<you> File "foo", line 3
37+
<you> File "hello.py", line 3
3838
<you> if a = b:
3939
<you> ^
4040
<you> SyntaxError: invalid syntax
4141

42-
### Websites to ask help on
42+
## Websites to ask help on
4343

4444
Personally, I've never asked a question on any of these sites. Getting
4545
help on IRC is much faster.

‎installing-python.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Let's get started!
1010

1111
## Downloading and installing Python
1212

13-
#### Windows
13+
### Windows
1414

1515
Use the official Python installer, it will install Python and IDLE for
1616
you.
@@ -22,12 +22,12 @@ you.
2222
4. Select the "advanced installation" option, and make sure the py.exe
2323
launcher gets installed.
2424

25-
#### Mac OSX
25+
### Mac OSX
2626

2727
I don't have an up-to-date copy of Mac OSX. If you would like to write
2828
instructions for OSX, [tell me](contact-me.md).
2929

30-
#### GNU/Linux
30+
### GNU/Linux
3131

3232
You already have Python, there's no need to download anything.
3333

@@ -49,7 +49,7 @@ I'm not going to focus on the third option in this tutorial, but if you
4949
know how to use Python with something else than PowerShell, command
5050
prompt, a terminal or IDLE it's fine. Do whatever you want.
5151

52-
#### If you are not an advanced user and you have no idea what PowerShell, command prompt and terminal are
52+
### If you are not an advanced user and you have no idea what PowerShell, command prompt and terminal are
5353

5454
Use IDLE. Experienced Python users will say that IDLE is garbage, but
5555
don't listen to them. These people want you to use "better"
@@ -74,7 +74,7 @@ take more screenshots:
7474
The exact content of your Python's welcome message is probably different
7575
than mine, it's ok.
7676

77-
#### If you like working with PowerShell, command prompt or terminal
77+
### If you like working with PowerShell, command prompt or terminal
7878

7979
On Windows. you should be able to run Python from a PowerShell window,
8080
or a command prompt window if you don't have PowerShell. Open one of

‎the-way-of-the-program.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ boring.
1010
When you're done reading, read the summary and make sure you've learned
1111
everything.
1212

13-
### Summary
13+
## Summary
1414

1515
- Now you should have some kind of idea about what programming is.
1616
- Each value has a type, and you can find that out with `type(value)`.

‎using-functions.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 3. Using functions and storing code in files
22

3-
### Functions
3+
## Functions
44

55
Now we know how to make Python show text.
66

@@ -103,7 +103,7 @@ Enter something: hello
103103
>>>
104104
```
105105

106-
### Storing code in files
106+
## Storing code in files
107107

108108
Now it's time to write some code into a file for the first time. In IDLE, go to File at top left and select New File, or just press Ctrl+N.
109109

@@ -136,7 +136,7 @@ After running the program you can check what the `word` variable contains in the
136136
>>>
137137
```
138138

139-
### Exercises
139+
## Exercises
140140

141141
1. Write a program into a file that asks the user to write a word and then prints that word 1000 times. For example, if the user enters `hi` the program would reply `hihihihi...`.
142142
2. Make it to print spaces between the words. It should be like `hi hi hi hi...`.

‎variables.md‎

Lines changed: 5 additions & 5 deletions

0 commit comments

Comments
 (0)