Skip to content

Commit 32dd107

Browse files
committed
fixed class object
1 parent a07c3dd commit 32dd107

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

.ipynb_checkpoints/Object Oriented Programming-checkpoint.ipynb

+21-21
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
},
113113
{
114114
"cell_type": "code",
115-
"execution_count": 6,
115+
"execution_count": 2,
116116
"metadata": {
117117
"collapsed": false
118118
},
@@ -121,13 +121,13 @@
121121
"name": "stdout",
122122
"output_type": "stream",
123123
"text": [
124-
"<type 'instance'>\n"
124+
"<class '__main__.Sample'>\n"
125125
]
126126
}
127127
],
128128
"source": [
129129
"# Create a new object type called Sample\n",
130-
"class Sample:\n",
130+
"class Sample(object):\n",
131131
" pass\n",
132132
"\n",
133133
"# Instance of Sample\n",
@@ -152,7 +152,7 @@
152152
"Let's get a better understanding of attributes through an example.\n",
153153
"\n",
154154
"##Attributes\n",
155-
"They syntax for creating an attribute is:\n",
155+
"The syntax for creating an attribute is:\n",
156156
" \n",
157157
" self.attribute = something\n",
158158
" \n",
@@ -165,13 +165,13 @@
165165
},
166166
{
167167
"cell_type": "code",
168-
"execution_count": 12,
168+
"execution_count": 3,
169169
"metadata": {
170170
"collapsed": true
171171
},
172172
"outputs": [],
173173
"source": [
174-
"class Dog():\n",
174+
"class Dog(object):\n",
175175
" def __init__(self,breed):\n",
176176
" self.breed = breed\n",
177177
" \n",
@@ -256,13 +256,13 @@
256256
},
257257
{
258258
"cell_type": "code",
259-
"execution_count": 14,
259+
"execution_count": 4,
260260
"metadata": {
261261
"collapsed": false
262262
},
263263
"outputs": [],
264264
"source": [
265-
"class Dog():\n",
265+
"class Dog(object):\n",
266266
" \n",
267267
" # Class Object Attribute\n",
268268
" species = 'mammal'\n",
@@ -274,7 +274,7 @@
274274
},
275275
{
276276
"cell_type": "code",
277-
"execution_count": 15,
277+
"execution_count": 5,
278278
"metadata": {
279279
"collapsed": true
280280
},
@@ -285,7 +285,7 @@
285285
},
286286
{
287287
"cell_type": "code",
288-
"execution_count": 19,
288+
"execution_count": 6,
289289
"metadata": {
290290
"collapsed": false
291291
},
@@ -296,7 +296,7 @@
296296
"'Sam'"
297297
]
298298
},
299-
"execution_count": 19,
299+
"execution_count": 6,
300300
"metadata": {},
301301
"output_type": "execute_result"
302302
}
@@ -314,7 +314,7 @@
314314
},
315315
{
316316
"cell_type": "code",
317-
"execution_count": 18,
317+
"execution_count": 7,
318318
"metadata": {
319319
"collapsed": false
320320
},
@@ -325,7 +325,7 @@
325325
"'mammal'"
326326
]
327327
},
328-
"execution_count": 18,
328+
"execution_count": 7,
329329
"metadata": {},
330330
"output_type": "execute_result"
331331
}
@@ -349,7 +349,7 @@
349349
},
350350
{
351351
"cell_type": "code",
352-
"execution_count": 22,
352+
"execution_count": 8,
353353
"metadata": {
354354
"collapsed": false
355355
},
@@ -364,7 +364,7 @@
364364
}
365365
],
366366
"source": [
367-
"class Circle:\n",
367+
"class Circle(object):\n",
368368
" pi = 3.14\n",
369369
"\n",
370370
" # Circle get instantiaed with a radius (default is 1)\n",
@@ -406,13 +406,13 @@
406406
},
407407
{
408408
"cell_type": "code",
409-
"execution_count": 23,
409+
"execution_count": 9,
410410
"metadata": {
411411
"collapsed": true
412412
},
413413
"outputs": [],
414414
"source": [
415-
"class Animal:\n",
415+
"class Animal(object):\n",
416416
" def __init__(self):\n",
417417
" print \"Animal created\"\n",
418418
"\n",
@@ -437,7 +437,7 @@
437437
},
438438
{
439439
"cell_type": "code",
440-
"execution_count": 24,
440+
"execution_count": 10,
441441
"metadata": {
442442
"collapsed": false
443443
},
@@ -539,13 +539,13 @@
539539
},
540540
{
541541
"cell_type": "code",
542-
"execution_count": 29,
542+
"execution_count": 11,
543543
"metadata": {
544544
"collapsed": true
545545
},
546546
"outputs": [],
547547
"source": [
548-
"class Book:\n",
548+
"class Book(object):\n",
549549
" def __init__(self, title, author, pages):\n",
550550
" print \"A book is created\"\n",
551551
" self.title = title\n",
@@ -564,7 +564,7 @@
564564
},
565565
{
566566
"cell_type": "code",
567-
"execution_count": 30,
567+
"execution_count": 12,
568568
"metadata": {
569569
"collapsed": false
570570
},

Object Oriented Programming.ipynb

+21-21
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
},
113113
{
114114
"cell_type": "code",
115-
"execution_count": 6,
115+
"execution_count": 2,
116116
"metadata": {
117117
"collapsed": false
118118
},
@@ -121,13 +121,13 @@
121121
"name": "stdout",
122122
"output_type": "stream",
123123
"text": [
124-
"<type 'instance'>\n"
124+
"<class '__main__.Sample'>\n"
125125
]
126126
}
127127
],
128128
"source": [
129129
"# Create a new object type called Sample\n",
130-
"class Sample:\n",
130+
"class Sample(object):\n",
131131
" pass\n",
132132
"\n",
133133
"# Instance of Sample\n",
@@ -152,7 +152,7 @@
152152
"Let's get a better understanding of attributes through an example.\n",
153153
"\n",
154154
"##Attributes\n",
155-
"They syntax for creating an attribute is:\n",
155+
"The syntax for creating an attribute is:\n",
156156
" \n",
157157
" self.attribute = something\n",
158158
" \n",
@@ -165,13 +165,13 @@
165165
},
166166
{
167167
"cell_type": "code",
168-
"execution_count": 12,
168+
"execution_count": 3,
169169
"metadata": {
170170
"collapsed": true
171171
},
172172
"outputs": [],
173173
"source": [
174-
"class Dog():\n",
174+
"class Dog(object):\n",
175175
" def __init__(self,breed):\n",
176176
" self.breed = breed\n",
177177
" \n",
@@ -256,13 +256,13 @@
256256
},
257257
{
258258
"cell_type": "code",
259-
"execution_count": 14,
259+
"execution_count": 4,
260260
"metadata": {
261261
"collapsed": false
262262
},
263263
"outputs": [],
264264
"source": [
265-
"class Dog():\n",
265+
"class Dog(object):\n",
266266
" \n",
267267
" # Class Object Attribute\n",
268268
" species = 'mammal'\n",
@@ -274,7 +274,7 @@
274274
},
275275
{
276276
"cell_type": "code",
277-
"execution_count": 15,
277+
"execution_count": 5,
278278
"metadata": {
279279
"collapsed": true
280280
},
@@ -285,7 +285,7 @@
285285
},
286286
{
287287
"cell_type": "code",
288-
"execution_count": 19,
288+
"execution_count": 6,
289289
"metadata": {
290290
"collapsed": false
291291
},
@@ -296,7 +296,7 @@
296296
"'Sam'"
297297
]
298298
},
299-
"execution_count": 19,
299+
"execution_count": 6,
300300
"metadata": {},
301301
"output_type": "execute_result"
302302
}
@@ -314,7 +314,7 @@
314314
},
315315
{
316316
"cell_type": "code",
317-
"execution_count": 18,
317+
"execution_count": 7,
318318
"metadata": {
319319
"collapsed": false
320320
},
@@ -325,7 +325,7 @@
325325
"'mammal'"
326326
]
327327
},
328-
"execution_count": 18,
328+
"execution_count": 7,
329329
"metadata": {},
330330
"output_type": "execute_result"
331331
}
@@ -349,7 +349,7 @@
349349
},
350350
{
351351
"cell_type": "code",
352-
"execution_count": 22,
352+
"execution_count": 8,
353353
"metadata": {
354354
"collapsed": false
355355
},
@@ -364,7 +364,7 @@
364364
}
365365
],
366366
"source": [
367-
"class Circle:\n",
367+
"class Circle(object):\n",
368368
" pi = 3.14\n",
369369
"\n",
370370
" # Circle get instantiaed with a radius (default is 1)\n",
@@ -406,13 +406,13 @@
406406
},
407407
{
408408
"cell_type": "code",
409-
"execution_count": 23,
409+
"execution_count": 9,
410410
"metadata": {
411411
"collapsed": true
412412
},
413413
"outputs": [],
414414
"source": [
415-
"class Animal:\n",
415+
"class Animal(object):\n",
416416
" def __init__(self):\n",
417417
" print \"Animal created\"\n",
418418
"\n",
@@ -437,7 +437,7 @@
437437
},
438438
{
439439
"cell_type": "code",
440-
"execution_count": 24,
440+
"execution_count": 10,
441441
"metadata": {
442442
"collapsed": false
443443
},
@@ -539,13 +539,13 @@
539539
},
540540
{
541541
"cell_type": "code",
542-
"execution_count": 29,
542+
"execution_count": 11,
543543
"metadata": {
544544
"collapsed": true
545545
},
546546
"outputs": [],
547547
"source": [
548-
"class Book:\n",
548+
"class Book(object):\n",
549549
" def __init__(self, title, author, pages):\n",
550550
" print \"A book is created\"\n",
551551
" self.title = title\n",
@@ -564,7 +564,7 @@
564564
},
565565
{
566566
"cell_type": "code",
567-
"execution_count": 30,
567+
"execution_count": 12,
568568
"metadata": {
569569
"collapsed": false
570570
},

0 commit comments

Comments
 (0)