diff --git a/1.md b/1.md index 8dabafe..19b298b 100644 --- a/1.md +++ b/1.md @@ -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 @@ -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 diff --git a/2.md b/2.md index 3d618ab..0e72412 100644 --- a/2.md +++ b/2.md @@ -1,4 +1,4 @@ -# 2. Strings, variables, booleans and None +# 2. Strings, variables, Booleans and None ### Strings @@ -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' @@ -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') @@ -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. @@ -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. diff --git a/4.md b/4.md index e5f484a..2f020a1 100644 --- a/4.md +++ b/4.md @@ -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 ================================ >>> @@ -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? diff --git a/README.md b/README.md index 0728171..4e6dc6d 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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)