Skip to content

Commit d3ffe40

Browse files
minor changes
1 parent aa92934 commit d3ffe40

File tree

2 files changed

+21
-40
lines changed

2 files changed

+21
-40
lines changed

6. Data structures.ipynb renamed to 5. Data structures.ipynb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,11 @@
247247
"\n",
248248
"![](images/immutable.jpg)\n",
249249
"\n",
250-
"- Tuples are faster than lists. If you're defining a constant set of values and all you're ever going to do with it is iterate through it, use a tuple instead of a list.\n",
250+
"- **Storage:** In CPython, tuples are stored in a single block of memory, so creating a new tuple involves at worst a single call to allocate memory. Lists are allocated in two blocks: the fixed one with all the Python object information and a variable sized block for the data. \n",
251251
"\n",
252+
"- **Indexing:** Tuples are faster than lists. Tuples directly reference their elements where as lists have an extra layer of indirection to an external array of pointers.\n",
252253
"\n",
253-
"- It makes your code safer if you “write-protect” data that does not need to be changed. Using a tuple instead of a list is like having an implied assert statement that this data is constant, and that special thought (and a specific function) is required to override that."
254+
"- **Safety:** It makes your code safer if you “write-protect” data that does not need to be changed. Using a tuple instead of a list is like having an implied assert statement that this data is constant, and that special thought (and a specific function) is required to override that.\n"
254255
]
255256
},
256257
{
@@ -392,6 +393,13 @@
392393
"outputs": [],
393394
"source": []
394395
},
396+
{
397+
"cell_type": "markdown",
398+
"metadata": {},
399+
"source": [
400+
"args, kwargs and call by object"
401+
]
402+
},
395403
{
396404
"cell_type": "markdown",
397405
"metadata": {},

5. Modules.ipynb renamed to 6. Modules.ipynb

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"metadata": {
6-
"deletable": true,
7-
"editable": true
8-
},
5+
"metadata": {},
96
"source": [
107
"# Modules"
118
]
129
},
1310
{
1411
"cell_type": "markdown",
15-
"metadata": {
16-
"deletable": true,
17-
"editable": true
18-
},
12+
"metadata": {},
1913
"source": [
2014
"You have seen how you can reuse code in your program by defining functions once. What if you wanted to reuse a number of functions in other programs that you write? As you might have guessed, the answer is modules.\n",
2115
"\n",
@@ -28,9 +22,7 @@
2822
"cell_type": "code",
2923
"execution_count": null,
3024
"metadata": {
31-
"collapsed": true,
32-
"deletable": true,
33-
"editable": true
25+
"collapsed": true
3426
},
3527
"outputs": [],
3628
"source": [
@@ -39,10 +31,7 @@
3931
},
4032
{
4133
"cell_type": "markdown",
42-
"metadata": {
43-
"deletable": true,
44-
"editable": true
45-
},
34+
"metadata": {},
4635
"source": [
4736
"### Challenge\n",
4837
"Write a python program which takes input from command line and outputs sum of two itegers."
@@ -52,19 +41,14 @@
5241
"cell_type": "code",
5342
"execution_count": null,
5443
"metadata": {
55-
"collapsed": true,
56-
"deletable": true,
57-
"editable": true
44+
"collapsed": true
5845
},
5946
"outputs": [],
6047
"source": []
6148
},
6249
{
6350
"cell_type": "markdown",
64-
"metadata": {
65-
"deletable": true,
66-
"editable": true
67-
},
51+
"metadata": {},
6852
"source": [
6953
"## The from..import statement "
7054
]
@@ -80,40 +64,29 @@
8064
"cell_type": "code",
8165
"execution_count": null,
8266
"metadata": {
83-
"collapsed": true,
84-
"deletable": true,
85-
"editable": true
67+
"collapsed": true
8668
},
8769
"outputs": [],
8870
"source": []
8971
},
9072
{
9173
"cell_type": "markdown",
92-
"metadata": {
93-
"deletable": true,
94-
"editable": true
95-
},
74+
"metadata": {},
9675
"source": [
9776
"### Challenges:\n",
9877
"[Polar Coordinates](https://www.hackerrank.com/challenges/polar-coordinates)"
9978
]
10079
},
10180
{
10281
"cell_type": "markdown",
103-
"metadata": {
104-
"deletable": true,
105-
"editable": true
106-
},
82+
"metadata": {},
10783
"source": [
10884
"## Making Your Own Modules"
10985
]
11086
},
11187
{
11288
"cell_type": "markdown",
113-
"metadata": {
114-
"deletable": true,
115-
"editable": true
116-
},
89+
"metadata": {},
11790
"source": [
11891
"## Problem with importing my modules\n",
11992
"\n",
@@ -144,7 +117,7 @@
144117
"name": "python",
145118
"nbconvert_exporter": "python",
146119
"pygments_lexer": "ipython3",
147-
"version": "3.5.2+"
120+
"version": "3.6.3"
148121
}
149122
},
150123
"nbformat": 4,

0 commit comments

Comments
 (0)