Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3f48bca

Browse files
Syntax highlight update
1 parent e217f08 commit 3f48bca

15 files changed

+22242
-15234
lines changed

‎.ipynb_checkpoints/DS_Dictionaries-checkpoint.ipynb

Lines changed: 82 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
"## Dictionary:\n",
2525
"Dictionaries are unordered collection of data.\n",
2626
"They are key-value mapping. \n",
27-
"Represented by Curly braces '{ }' \n",
28-
"`dictionary : {1:10, 2:20, 3:30, 4:'Hello', 5:-2.0}`\n",
27+
"Represented by Curly braces `{}` \n",
28+
"\n",
29+
"```python\n",
30+
"dictionary : {1: 10, 2: 20, 3: 30, 4: 'Hello', 5: -2.0}\n",
31+
"```\n",
2932
"\n",
3033
"Defined by - key : value. \n",
3134
"Each key-value map is separated by comma (,)\n",
@@ -45,9 +48,14 @@
4548
"2. dict()\n",
4649
"\n",
4750
"### 1. '{}'\n",
51+
"```python\n",
4852
"dict1 = {1:10, 2:20, 3:30}\n",
53+
"```\n",
4954
"### 2. dict()\n",
50-
"Syntax: `dict(iterable = None)` \n",
55+
"Syntax: \n",
56+
"```python\n",
57+
"dict(iterable = None)\n",
58+
"``` \n",
5159
"iterable: any data structures listed above given that elements are present as key value mapping. "
5260
]
5361
},
@@ -130,7 +138,10 @@
130138
"### 1. len:\n",
131139
"Returns the length of the given iterable.\n",
132140
"\n",
133-
"Syntax: `len(iterable)`"
141+
"Syntax: \n",
142+
"```python\n",
143+
"len(iterable)\n",
144+
"```"
134145
]
135146
},
136147
{
@@ -161,7 +172,10 @@
161172
"### 2. str:\n",
162173
"Returns the string format of the given dictionary.\n",
163174
"\n",
164-
"Syntax: `str(dict)`"
175+
"Syntax: \n",
176+
"```python\n",
177+
"str(dict)\n",
178+
"```"
165179
]
166180
},
167181
{
@@ -192,7 +206,10 @@
192206
"### 3. clear:\n",
193207
"Deletes the items in the dictionary.\n",
194208
"\n",
195-
"Syntax: `dict.clear()`"
209+
"Syntax: \n",
210+
"```python\n",
211+
"dict.clear()\n",
212+
"```"
196213
]
197214
},
198215
{
@@ -224,7 +241,10 @@
224241
"### 4. copy:\n",
225242
"Returns the shallow copy of the given dictionary.\n",
226243
"\n",
227-
"Syntax: `dict.copy()`"
244+
"Syntax: \n",
245+
"```python\n",
246+
"dict.copy()\n",
247+
"```"
228248
]
229249
},
230250
{
@@ -256,7 +276,10 @@
256276
"### 5. fromkeys:\n",
257277
"Returns a new dictionary form the given list of keys. By default the values are set to None.\n",
258278
"\n",
259-
"Syntax: `dict.fromkeys(sep, val = None)`"
279+
"Syntax: \n",
280+
"```python\n",
281+
"dict.fromkeys(sep, val = None)\n",
282+
"```"
260283
]
261284
},
262285
{
@@ -310,7 +333,10 @@
310333
"### 6. get:\n",
311334
"Returns the value of the given key if present else returns the default value given (None by Default).\n",
312335
"\n",
313-
"Syntax: `dict.get(key, default = None)`"
336+
"Syntax: \n",
337+
"```python\n",
338+
"dict.get(key, default = None)\n",
339+
"```"
314340
]
315341
},
316342
{
@@ -380,7 +406,10 @@
380406
"### 7. items:\n",
381407
"Returns the list of key-value pairs in the dictionary.\n",
382408
"\n",
383-
"Syntax: `dict.items()`"
409+
"Syntax: \n",
410+
"```python\n",
411+
"dict.items()\n",
412+
"```"
384413
]
385414
},
386415
{
@@ -411,7 +440,10 @@
411440
"### 8. keys:\n",
412441
"Returns the list of keys present in the dictionary.\n",
413442
"\n",
414-
"Syntax: `dict.keys()`"
443+
"Syntax: \n",
444+
"```python\n",
445+
"dict.keys()\n",
446+
"```"
415447
]
416448
},
417449
{
@@ -442,7 +474,10 @@
442474
"### 9. values:\n",
443475
"Returns the list of values present on the dictionary.\n",
444476
"\n",
445-
"Syntax: `dict.values()`"
477+
"Syntax: \n",
478+
"```python\n",
479+
"dict.values()\n",
480+
"```"
446481
]
447482
},
448483
{
@@ -473,7 +508,10 @@
473508
"### 10. update:\n",
474509
"Adds the key-value pairs in second dictionary to the first.\n",
475510
"\n",
476-
"Syntax: `dict.update(dict)`"
511+
"Syntax: \n",
512+
"```python\n",
513+
"dict.update(dict)\n",
514+
"```"
477515
]
478516
},
479517
{
@@ -506,7 +544,10 @@
506544
"### 11. pop:\n",
507545
"Removes and returns the value of given key. If the key is absent, Error is raised if default is not given.\n",
508546
"\n",
509-
"Syntax: `dict.pop(key, [default])`"
547+
"Syntax: \n",
548+
"```python\n",
549+
"dict.pop(key, [default])\n",
550+
"```"
510551
]
511552
},
512553
{
@@ -597,7 +638,10 @@
597638
"### 12. popitem:\n",
598639
"Removes and returns the last key-value pair of the dictionary.\n",
599640
"\n",
600-
"Syntax: `dict.popitem()`"
641+
"Syntax: \n",
642+
"```python\n",
643+
"dict.popitem()\n",
644+
"```"
601645
]
602646
},
603647
{
@@ -636,7 +680,10 @@
636680
"### 13. setdefault:\n",
637681
"Sets the default value to key if the key is absent.\n",
638682
"\n",
639-
"Syntax: `dict.setdefault(key, value)`"
683+
"Syntax: \n",
684+
"```python\n",
685+
"dict.setdefault(key, value)\n",
686+
"```"
640687
]
641688
},
642689
{
@@ -668,7 +715,10 @@
668715
"## Accessing elements:\n",
669716
"The values in the dictionary are accessed by key.\n",
670717
"\n",
671-
"Syntax: `dictionary[key]`"
718+
"Syntax: \n",
719+
"```python\n",
720+
"dictionary[key]\n",
721+
"```"
672722
]
673723
},
674724
{
@@ -742,7 +792,12 @@
742792
"## Adding or Modifying items:\n",
743793
"Items can be added or modified by using keys.\n",
744794
"\n",
745-
"Syntax: `dictaionary[key] = value` "
795+
"If the key already exists, the value is replcaed by the new value. If not, new key-value pair is created\n",
796+
"\n",
797+
"Syntax: \n",
798+
"```python\n",
799+
"dictaionary[key] = value\n",
800+
"``` "
746801
]
747802
},
748803
{
@@ -775,7 +830,10 @@
775830
"## Delete Elements:\n",
776831
"Elements can be deleted by using the *del* keyword.\n",
777832
"\n",
778-
"Syntax: `del dict[key]`"
833+
"Syntax: \n",
834+
"```python\n",
835+
"del dict[key]\n",
836+
"```"
779837
]
780838
},
781839
{
@@ -901,7 +959,10 @@
901959
"## Dictionaries and list Comprehension:\n",
902960
"Dictionaries can be defined by comprehensions.\n",
903961
"\n",
904-
"Syntax: `dict = {key: value (loops)}`"
962+
"Syntax: \n",
963+
"```python\n",
964+
"dict = {key: value (loops)}\n",
965+
"```"
905966
]
906967
},
907968
{
@@ -973,7 +1034,7 @@
9731034
"name": "python",
9741035
"nbconvert_exporter": "python",
9751036
"pygments_lexer": "ipython3",
976-
"version": "3.8.6"
1037+
"version": "3.9.6"
9771038
}
9781039
},
9791040
"nbformat": 4,

‎.ipynb_checkpoints/DS_Sets-checkpoint.ipynb

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@
2323
"source": [
2424
"## Sets:\n",
2525
"Sets are unordered collection of unique data.\n",
26-
"Enclosed by Curly braces '{ }' \n",
27-
"`set: {10, 20.2, 30.0}`\n",
26+
"Enclosed by Curly braces `{}` \n",
27+
"\n",
28+
"```python\n",
29+
"set: {10, 20.2, 30.0}\n",
30+
"```\n",
2831
"\n",
2932
"Each value in the set is called a element \n",
3033
"Since set is unordered collection, it cannot be indexed. The elements are randomly stored."
@@ -38,10 +41,13 @@
3841
"\n",
3942
"### set() method\n",
4043
"\n",
41-
"Syntax: `set(iterable = None)` \n",
44+
"Syntax: \n",
45+
"```python\n",
46+
"set(iterable = None)\n",
47+
"``` \n",
4248
"iterable: any data structures listed above \n",
4349
"\n",
44-
"By default the { } map to a dictionary. So empty curly braces cannot be used."
50+
"By default the `{}` map to a dictionary. So empty curly braces cannot be used."
4551
]
4652
},
4753
{
@@ -92,8 +98,10 @@
9298
"metadata": {},
9399
"source": [
94100
"### Getting set as input:\n",
101+
"```python\n",
95102
"s1 = set(input()) \n",
96-
"s2 = set(input().split())"
103+
"s2 = set(input().split())\n",
104+
"```"
97105
]
98106
},
99107
{
@@ -961,7 +969,7 @@
961969
"name": "python",
962970
"nbconvert_exporter": "python",
963971
"pygments_lexer": "ipython3",
964-
"version": "3.8.6"
972+
"version": "3.9.6"
965973
}
966974
},
967975
"nbformat": 4,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /