1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
{
"metadata": {
"name": "",
"signature": "sha256:a2f721b4c266424e2bea1224b09de694c0f19e61e65e603f28f9ade00148c17a"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Hour 4: Understanding Data Types and Keywords"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4.1, Page No.60"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"c1='A'\n",
"c2='a'\n",
"\n",
"print \"Convert the value of c1 to character : \",c1\n",
"print \"Convert the value of c2 to character : \",c2"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Convert the value of c1 to character : A\n",
"Convert the value of c2 to character : a\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4.2, Page No.61"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"c1=65\n",
"c2=97\n",
"\n",
"print \"The character that has numeric value of 65 is:\", chr(c1)\n",
"print \"The character that has numeric value of 97 is:\", chr(c2)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The character that has numeric value of 65 is: A\n",
"The character that has numeric value of 97 is: a\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4.3, Page No.63"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"c1='A'\n",
"c2='a'\n",
"print \"The Numeric Value of A is:\",ord(c1)\n",
"print \"The Numeric Value of a is:\",ord(c2)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The Numeric Value of A is: 65\n",
"The Numeric Value of a is: 97\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4.4, Page No.65"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"int_num1=int(32/10)\n",
"flt_num1=float(32/10)\n",
"int_num2=int(32.0/10)\n",
"flt_num2=float(32.0/10)\n",
"int_num3=int(32/10.0)\n",
"flt_num3=float(32/10.0)\n",
"\n",
"print \"The integer divis. of 32/10 is\",int_num1\n",
"print \"The floating-point divis. of 32/10 is\",flt_num1\n",
"\n",
"print \"The integer divis. of 32.0/10 is\",int_num2\n",
"print \"The floating-point divis. of 32.0/10 is\",flt_num2\n",
"\n",
"print \"The integer divis. of 32/10.0 is\",int_num3\n",
"print \"The floating-point divis. of 32/10.0 is\",flt_num3"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The integer divis. of 32/10 is 3\n",
"The floating-point divis. of 32/10 is 3.0\n",
"The integer divis. of 32.0/10 is 3\n",
"The floating-point divis. of 32.0/10 is 3.2\n",
"The integer divis. of 32/10.0 is 3\n",
"The floating-point divis. of 32/10.0 is 3.2\n"
]
}
],
"prompt_number": 10
}
],
"metadata": {}
}
]
}
|