Skip to content

Fixed spelling errors and repharsed a sentence. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 1.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The `>>>` in the beginning of the line means that IDLE is ready and you can ente

### Using Python as a calculator

In the interactive `>>>` mode, IDLE will simply echo back everything you type into it. One of the simpliest things you can type are numbers:
In the interactive `>>>` mode, IDLE will simply echo back everything you type into it. One of the simplest things you can type are numbers:

```py
>>> 1
Expand Down Expand Up @@ -192,7 +192,7 @@ Python uses radians instead of degrees, so degrees need to be converted to radia
>>>
```

See the [offical documentation of the math module](https://docs.python.org/3/library/math.html) for more info about it.
See the [official documentation of the math module](https://docs.python.org/3/library/math.html) for more info about it.

### Exercises

Expand Down
10 changes: 5 additions & 5 deletions 2.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 2. Strings, variables, booleans and None
# 2. Strings, variables, Booleans and None

### Strings

Expand All @@ -20,7 +20,7 @@ NameError: name 'hello' is not defined
>>>
```

But putting the text in quotes works. You can use single quotes or double quotes. They work the same way, but things entered with double quotes will be echoed back with single quotes. Pieces of text inside quotes with text inside them are known as strings.
But putting the text in quotes works. You can use single quotes or double quotes. They work the same way, but things entered with double quotes will be echoed back with single quotes. Pieces of text inside quotes are known as strings.

```py
>>> 'hello'
Expand Down Expand Up @@ -65,7 +65,7 @@ TypeError: Can't convert 'int' object to str implicitly
>>>
```

You can also use `len` to get the length of a string in characters. This will come in handy later in this tutorial.
You can also use `len()` to get the length of a string in characters. This will come in handy later in this tutorial.

```py
>>> len('hello')
Expand Down Expand Up @@ -98,7 +98,7 @@ Variables are easy to understand. They simply contain data. _[*]_
>>>
```

_[*] In fact, variables point to data stored in the computer's memory. All strings, integers and other objects are just data in the RAM. See [this video](https://www.youtube.com/watch?v=_AEJHKGk9ns) for more info._
_[*] In fact, variables point to data stored in the computer's memory. All strings, integers and other objects are just data in RAM. See [this video](https://www.youtube.com/watch?v=_AEJHKGk9ns) for more info._

Variable names can be multiple characters long. They can contain uppercase characters and special characters, but most of the time you should be using simple, lowercase variable names. You can also use underscores.

Expand Down Expand Up @@ -171,7 +171,7 @@ Now you also understand why typing hello to the prompt didn't work in the beginn
>>>
```

### booleans and None
### Booleans and None

In Python, and many other programming languages, `=` is assigning and `==` is comparing. `a = 1` sets a to 1 and `a == 1` checks if a is 1.

Expand Down
4 changes: 2 additions & 2 deletions 4.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ while its_raining:
# We'll jump back to the second line from here
```

Don't get scared when you ran the program. Like I wrote in the introduction, this will not destroy or crash your computer. It just repeats the same thing quickly. You can interrupt the program by hitting Ctrl+C. You'll get an error message saying that a `KeyboardInterrupt` occurred, that's normal. The output is like this:
Don't get scared when you run the program. Like I wrote in the introduction, this will not destroy or crash your computer. It just repeats the same thing quickly. You can interrupt the program by hitting Ctrl+C. You'll get an error message saying that a `KeyboardInterrupt` occurred, that's normal. The output is like this:

>>> ================================ RESTART ================================
>>>
Expand Down Expand Up @@ -204,7 +204,7 @@ Again, you can interrupt the program with Ctrl+C.
_[*] There are many ways to interrupt while loops, including `while True` loops. `break` will end the innermost loop it's in, and `exit()` will quit the whole program._

### Exercises
1. Make a program that asks for a password and prints `Welcome!`, `Access denied` or `You didn't enter anything` depending on did the user enter the correct password, a wrong password or nothing at all by pressing Enter without typing anything.
1. Make a program that asks for a password and prints `Welcome!`, `Access denied` or `You didn't enter anything` depending on whether the user entered the correct password, a wrong password, or nothing at all by pressing Enter without typing anything.
2. Make a program that asks for username and password and checks them. Make users "foo" and "bar" with passwords "biz" and "baz".
3. Make a program that asks for username and password and gives the user an infinite number of attempts, so the user can always try again if he mistypes the password.
4. Can you limit the number of attempts to 3?
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[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.

No tutorial is good for everyone. This one is aimed at people with no programming experience at all. If you have programmed in the past with some other language you probably want to read [the offical tutorial](https://docs.python.org/3/tutorial/) instead. Like most other tutorials, this tutorial starts with maths. You can skip that if you hate maths.
No tutorial is good for everyone. This one is aimed at people with no programming experience at all. If you have programmed in the past with 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. You can skip that if you hate math.

This tutorial uses Python 3. Python 2 is not under active development anymore, and more and more projects are moving to Python 3. Currently there are a few packages that don't support Python 3 that well at the time of writing this (such as twisted), but if you haven't programmed yet Python 3 is a great choice.

Expand All @@ -17,6 +17,6 @@ Most importantly, when learning a programming language you need to **experiment
Here's a list of chapters in this tutorial:

1. [Installing Python and using it as a calculator](1.md)
2. [Strings, variables, booleans and None](2.md)
2. [Strings, variables, Booleans and None](2.md)
3. [Using functions and storing code in files](3.md)
4. [If, elif, else and while](4.md)