Skip to content

Commit 1dc9bd0

Browse files
committed
2 parents 6852d84 + 430f4ec commit 1dc9bd0

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

lists-and-tuples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ There's many things [we can do with strings](handy-stuff-strings.md),
5353
and some of these things also work with lists.
5454

5555
```py
56-
>>> len(names) # we have 5 names
56+
>>> len(names) # len is short for length, we have 5 names
5757
5
5858
>>> names + ['Akuli'] # create a new list with me in it
5959
['wub_wub', 'theelous3', 'RubyPinch', 'go|dfish', 'Nitori', 'Akuli']

loops.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ There are different kinds of loops:
55

66
- [While loops](#while-loops) repeat something while a condition is true.
77
- [Until loops](#until-loops) repeat something while a condition is false.
8-
- [For loops](#for-loops) repeat something for each element of a list.
8+
- [For loops](#for-loops) repeat something for each element of something.
99

1010
We'll talk about all of these in this tutorial.
1111

@@ -149,8 +149,8 @@ print("It's raining!")
149149

150150
## For loops
151151

152-
Let's say we have a list of things we want to print. To print each item
153-
in stuff, we could just do a bunch of prints:
152+
Let's say we have [a list](lists-and-tuples.md) of things we want to
153+
print. To print each item in it, we could just do a bunch of prints:
154154

155155
```py
156156
stuff = ['hello', 'hi', 'how are you doing', 'im fine', 'how about you']
@@ -178,7 +178,7 @@ We could also create an index variable, and use a while loop:
178178

179179
```py
180180
>>> stuff = ['hello', 'hi', 'how are you doing', 'im fine', 'how about you']
181-
>>> length_of_stuff = len(stuff) # len(stuff) is 5
181+
>>> length_of_stuff = len(stuff)
182182
>>> index = 0
183183
>>> while index < length_of_stuff:
184184
... print(stuff[index])
@@ -230,16 +230,7 @@ how about you
230230
Note that `for thing in stuff:` is not same as `for (thing in stuff):`.
231231
Here the `in` keyword is just a part of the for loop and it has a
232232
different meaning than it would have if we had `thing in stuff` without
233-
a `for`. Trying to do `for (thing in stuff):` creates an error:
234-
235-
```py
236-
>>> for (thing in stuff):
237-
File "<stdin>", line 1
238-
for (thing in stuff):
239-
^
240-
SyntaxError: invalid syntax
241-
>>>
242-
```
233+
a `for`. Trying to do `for (thing in stuff):` creates an error.
243234

244235
Right now the while loop version might seem easier to understand for
245236
you, but later you'll realize that for loops are much easier to work

using-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ text appears on the screen right away when we run `print(something)`.
5454
## Return values
5555

5656
If we do `thingy = print('hello')`, what does the `thingy` variable end
57-
up [pointing to](variables.md)?
57+
up [pointing to](variables.md#variables)?
5858

5959
```py
6060
>>> thingy = print('hello')

0 commit comments

Comments
 (0)