You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -20,7 +20,7 @@ NameError: name 'hello' is not defined
20
20
>>>
21
21
```
22
22
23
-
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.
23
+
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.
24
24
25
25
```py
26
26
>>>'hello'
@@ -65,7 +65,7 @@ TypeError: Can't convert 'int' object to str implicitly
65
65
>>>
66
66
```
67
67
68
-
You can also use `len` to get the length of a string in characters. This will come in handy later in this tutorial.
68
+
You can also use `len()` to get the length of a string in characters. This will come in handy later in this tutorial.
69
69
70
70
```py
71
71
>>>len('hello')
@@ -98,7 +98,7 @@ Variables are easy to understand. They simply contain data. _[*]_
98
98
>>>
99
99
```
100
100
101
-
_[*] 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._
101
+
_[*] 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._
102
102
103
103
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.
104
104
@@ -171,7 +171,7 @@ Now you also understand why typing hello to the prompt didn't work in the beginn
171
171
>>>
172
172
```
173
173
174
-
### booleans and None
174
+
### Booleans and None
175
175
176
176
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.
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:
174
+
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:
@@ -204,7 +204,7 @@ Again, you can interrupt the program with Ctrl+C.
204
204
_[*] 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._
205
205
206
206
### Exercises
207
-
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.
207
+
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.
208
208
2. Make a program that asks for username and password and checks them. Make users "foo" and "bar" with passwords "biz" and "baz".
209
209
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.
0 commit comments