|
9 | 9 | },
|
10 | 10 | {
|
11 | 11 | "cell_type": "code",
|
12 |
| - "execution_count": 1, |
| 12 | + "execution_count": 7, |
13 | 13 | "metadata": {},
|
14 | 14 | "outputs": [
|
15 | 15 | {
|
16 | 16 | "name": "stdout",
|
17 | 17 | "output_type": "stream",
|
18 | 18 | "text": [
|
19 |
| - "{'name': 'Sarmad', 'email': '[email protected]', 'age': 19}\n" |
| 19 | + "{'name': 'Sarmad', 'email': '[email protected]', 'age': 20}\n" |
20 | 20 | ]
|
21 | 21 | }
|
22 | 22 | ],
|
23 | 23 | "source": [
|
24 | 24 | "from typing import Union\n",
|
25 | 25 | "\n",
|
26 |
| - "type_user_dict = Union[dict[str, str | int], dict[str, str]]\n", |
| 26 | + "UserDictType = Union[dict[str, str | int]]\n", |
27 | 27 | "\n",
|
28 |
| - "user: type_user_dict = {\"name\": \"Sarmad\", \"email\": \"[email protected]\", \"age\": 19}\n", |
| 28 | + "user: UserDictType = {\"name\": \"Sarmad\", \"email\": \"[email protected]\", \"age\": 20}\n", |
29 | 29 | "\n",
|
30 | 30 | "print(user)"
|
31 | 31 | ]
|
|
39 | 39 | },
|
40 | 40 | {
|
41 | 41 | "cell_type": "code",
|
42 |
| - "execution_count": 2, |
| 42 | + "execution_count": 8, |
43 | 43 | "metadata": {},
|
44 | 44 | "outputs": [
|
45 | 45 | {
|
|
48 | 48 | "'Male'"
|
49 | 49 | ]
|
50 | 50 | },
|
51 |
| - "execution_count": 2, |
| 51 | + "execution_count": 8, |
52 | 52 | "metadata": {},
|
53 | 53 | "output_type": "execute_result"
|
54 | 54 | }
|
|
68 | 68 | },
|
69 | 69 | {
|
70 | 70 | "cell_type": "code",
|
71 |
| - "execution_count": 3, |
| 71 | + "execution_count": 9, |
72 | 72 | "metadata": {},
|
73 | 73 | "outputs": [
|
74 | 74 | {
|
|
77 | 77 |
|
78 | 78 | ]
|
79 | 79 | },
|
80 |
| - "execution_count": 3, |
| 80 | + "execution_count": 9, |
81 | 81 | "metadata": {},
|
82 | 82 | "output_type": "execute_result"
|
83 | 83 | }
|
|
97 | 97 | },
|
98 | 98 | {
|
99 | 99 | "cell_type": "code",
|
100 |
| - "execution_count": 4, |
| 100 | + "execution_count": 10, |
101 | 101 | "metadata": {},
|
102 | 102 | "outputs": [
|
103 | 103 | {
|
|
106 | 106 |
|
107 | 107 | ]
|
108 | 108 | },
|
109 |
| - "execution_count": 4, |
| 109 | + "execution_count": 10, |
110 | 110 | "metadata": {},
|
111 | 111 | "output_type": "execute_result"
|
112 | 112 | }
|
|
126 | 126 | },
|
127 | 127 | {
|
128 | 128 | "cell_type": "code",
|
129 |
| - "execution_count": 5, |
| 129 | + "execution_count": 11, |
130 | 130 | "metadata": {},
|
131 | 131 | "outputs": [
|
132 | 132 | {
|
|
135 | 135 | "dict_keys(['name', 'email', 'age', 'gender'])"
|
136 | 136 | ]
|
137 | 137 | },
|
138 |
| - "execution_count": 5, |
| 138 | + "execution_count": 11, |
139 | 139 | "metadata": {},
|
140 | 140 | "output_type": "execute_result"
|
141 | 141 | }
|
|
153 | 153 | },
|
154 | 154 | {
|
155 | 155 | "cell_type": "code",
|
156 |
| - "execution_count": 6, |
| 156 | + "execution_count": 12, |
157 | 157 | "metadata": {},
|
158 | 158 | "outputs": [
|
159 | 159 | {
|
160 | 160 | "data": {
|
161 | 161 | "text/plain": [
|
162 |
| - "dict_values(['Sarmad', '[email protected]', 19, 'Male'])" |
| 162 | + "dict_values(['Sarmad', '[email protected]', 20, 'Male'])" |
163 | 163 | ]
|
164 | 164 | },
|
165 |
| - "execution_count": 6, |
| 165 | + "execution_count": 12, |
166 | 166 | "metadata": {},
|
167 | 167 | "output_type": "execute_result"
|
168 | 168 | }
|
|
180 | 180 | },
|
181 | 181 | {
|
182 | 182 | "cell_type": "code",
|
183 |
| - "execution_count": 7, |
| 183 | + "execution_count": 13, |
184 | 184 | "metadata": {},
|
185 | 185 | "outputs": [
|
186 | 186 | {
|
187 | 187 | "data": {
|
188 | 188 | "text/plain": [
|
189 |
| - "{'name': 'Sarmad', 'email': '[email protected]', 'age': 19}" |
| 189 | + "{'name': 'Sarmad', 'email': '[email protected]', 'age': 20}" |
190 | 190 | ]
|
191 | 191 | },
|
192 |
| - "execution_count": 7, |
| 192 | + "execution_count": 13, |
193 | 193 | "metadata": {},
|
194 | 194 | "output_type": "execute_result"
|
195 | 195 | }
|
|
209 | 209 | },
|
210 | 210 | {
|
211 | 211 | "cell_type": "code",
|
212 |
| - "execution_count": 8, |
| 212 | + "execution_count": 14, |
213 | 213 | "metadata": {},
|
214 | 214 | "outputs": [
|
215 | 215 | {
|
|
218 | 218 | "{}"
|
219 | 219 | ]
|
220 | 220 | },
|
221 |
| - "execution_count": 8, |
| 221 | + "execution_count": 14, |
222 | 222 | "metadata": {},
|
223 | 223 | "output_type": "execute_result"
|
224 | 224 | }
|
|
238 | 238 | },
|
239 | 239 | {
|
240 | 240 | "cell_type": "code",
|
241 |
| - "execution_count": 9, |
| 241 | + "execution_count": 24, |
242 | 242 | "metadata": {},
|
243 | 243 | "outputs": [
|
244 | 244 | {
|
245 | 245 | "name": "stdout",
|
246 | 246 | "output_type": "stream",
|
247 | 247 | "text": [
|
248 |
| - "Six Seven Two Nine One Seven Eight Three Nine Two One \n" |
| 248 | + "Seven One Nine Eight One Six Three One \n" |
249 | 249 | ]
|
250 | 250 | }
|
251 | 251 | ],
|
|
268 | 268 | "user_input = input(\"Phone Number: \")\n",
|
269 | 269 | "\n",
|
270 | 270 | "for ch in user_input:\n",
|
271 |
| - " output += characters.get(ch, \"\") + \" \"\n", |
| 271 | + " if not ch in characters:\n", |
| 272 | + " pass\n", |
| 273 | + " else:\n", |
| 274 | + " output += characters.get(ch, \"\") + \" \" # Adding a space after each character\n", |
272 | 275 | "print(output)"
|
273 | 276 | ]
|
274 | 277 | },
|
|
283 | 286 | },
|
284 | 287 | {
|
285 | 288 | "cell_type": "code",
|
286 |
| - "execution_count": 6, |
| 289 | + "execution_count": 26, |
287 | 290 | "metadata": {},
|
288 | 291 | "outputs": [
|
289 | 292 | {
|
290 | 293 | "name": "stdout",
|
291 | 294 | "output_type": "stream",
|
292 | 295 | "text": [
|
293 |
| - "Name :Sarmad\n", |
294 |
| - |
| 296 | + "Name : Sarmad\n", |
| 297 | + |
295 | 298 | "Age: 19\n"
|
296 | 299 | ]
|
297 | 300 | }
|
298 | 301 | ],
|
299 | 302 | "source": [
|
300 |
| - "user: type_user_dict = {\"name\": \"Sarmad\", \"email\": \"[email protected]\", \"age\": 19}\n", |
| 303 | + "user: UserDictType = {\"name\": \"Sarmad\", \"email\": \"[email protected]\", \"age\": 19}\n", |
301 | 304 | "\n",
|
302 | 305 | "\n",
|
303 | 306 | "def user_details(name: str, email: str, age: int) -> None:\n",
|
304 |
| - " print(f\"Name :{name}\\nEmail {email}\\nAge: {age}\")\n", |
| 307 | + " print(f\"Name : {name}\\nEmail: {email}\\nAge: {age}\")\n", |
305 | 308 | "\n",
|
306 | 309 | "\n",
|
307 | 310 | "user_details(**user)"
|
|
383 | 386 | "name": "python",
|
384 | 387 | "nbconvert_exporter": "python",
|
385 | 388 | "pygments_lexer": "ipython3",
|
386 |
| - "version": "3.12.0" |
| 389 | + "version": "3.12.6" |
387 | 390 | }
|
388 | 391 | },
|
389 | 392 | "nbformat": 4,
|
|
0 commit comments