Skip to content

Commit d2c9742

Browse files
committed
Update examples.md
1 parent ffcb887 commit d2c9742

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

examples.md

+23
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22

33
> These expand on the examples provided in the tutorial files, so that you can see other ways some of these concepts can be used, or get more practice guessing what they'll do, or use them as a springboard for your own code.
44
5+
## for loops
6+
7+
```python
8+
tutorial = ["Hello World", "Math", "Boolean operators", "Lists", "Iteration",
9+
"Control flow", "Functions", "Object-oriented programming"]
10+
11+
class Rachael:
12+
def __init__(self, tut_list):
13+
self.tutorial = tut_list
14+
15+
def say(self, utterance):
16+
print(utterance)
17+
18+
def introduce_topics(self):
19+
for section in self.tutorial:
20+
self.say(section + " is a really important and useful tool!")
21+
22+
23+
24+
rachael = Rachael(tutorial)
25+
rachael.introduce_topics()
26+
```
27+
528
## Functions
629

730
```python

for_example.py

-20
This file was deleted.

0 commit comments

Comments
 (0)